Firebird組み込み非インストール版をクリックして使用します.


 Firebird           
   :http://blog.sciencenet.cn/blog-244606-335088.html

Firebird    firebird       ,     ,   ,       。          ,             。

  firebird                  ,                  。  :       ,   ,          (         )

             ,Firebird           ,      、      、    ,   Embeded     Firebird   .NET             :   fbembed.dll (               )    ADO.NET Data Provider   FirebirdSql.Data.Firebird.dll。                       ,         (  MSDE)     。

  ,   ,              , 30%        Access, 30%      MSDE 2000, 30%      Embedded Firebird,  10%         , SQLite,MySQL  。

     Access,MSDE 2000,Embedded Firebird,SQLite          (free redistributable)    。    ,MSDE 2000          ,            SQL Server       ,    。Access          ,          ,       、         ,      。SQLite    ,          ,       .NET Data Provider       。Firebird     :   、        (   XCOPY     )、    、    、   ,.NET Data Provider         。

Firebird    SuperServer Embedded    ,        ,   TCP  。       , Embedded      SuperServer,            ServerType   。

1.1 Firebird Data Provider For .NET    Firebird    

  :http://blog.csdn.net/HiSpring/archive/2010/02/17/5310243.aspx

1、   Firebird       :Firebird-2.5.0.25920-0_Win32_embed_pdb_RC2(ZIP  ,8.5MB)            ,    。 

2、                  :Firebird            ,      IBManager,     EXE   ,   。 

3、           :  1               firebird.msg   intl、udf                       。 :                   ,           。 

4、        :  1                 6           :fbembed.dll、firebird.conf、ib_util.dll、icudt30.dll、icuin30.dll、icuuc30.dll。 

5、   Firebird .NET Provider   dll :     Firebird.Net Provider v2.5.1 (ZIP  ,200KB),  ,     FirebirdSql.Data.FirebirdClient.dll        。 

6、  :           ,     FbConnectionStringBuilder        ,      : 

 

using FirebirdSql.Data.FirebirdClient;   

  

FbConnectionStringBuilder connBuilder = new FbConnectionStringBuilder();   

connBuilder.UserID = userId;//     ,            。   

connBuilder.ServerType = FbServerType.Embedded;//            ;   

connBuilder.Database = dbFile;//        ;   

  

using (FbConnection fbConn = new FbConnection(connBuilder.ConnectionString))   

{   

    fbConn.Open();   

    Console.WriteLine("    !");     

    fbConn.Close();    

}  

 

      2.0  

        Debug  :

 

1.2  Firebird     

private void btn_NewDataBase_Click(object sender, EventArgs e)

        {

            FbConnection.CreateDatabase(GetConnectionString());

        }

        static string GetConnectionString()

        {

            FbConnectionStringBuilder cs = new FbConnectionStringBuilder();

            cs.Database = "     .fdb";

            cs.UserID = "SYSDBA";

            cs.Password = "masterkey";

            //cs.Charset = "UTF8"; //         ,                            

            cs.ServerType = FbServerType.Embedded; //            

            return cs.ToString();

        }



          SYSDBA,     masterkey ,                ,      :

static string GetConnectionString2()

        {

            FbConnectionStringBuilder cs = new FbConnectionStringBuilder();

            cs.Database = "     2.fdb";

            cs.UserID = "MOUSTUDIO";

            cs.Password = "851021mou";

            //cs.Charset = "UTF8"; //         ,                            

            cs.ServerType = FbServerType.Embedded; //            

            return cs.ToString();

        }


 

1.3     

using (FbConnection conn = new FbConnection(GetConnectionString()))

{

     conn.Open();

     using (FbCommand createTable = conn.CreateCommand())

     {

createTable.CommandText = "create table Table_MouCH (id int, name varchar(20) character set gb2312)";

             createTable.ExecuteNonQuery();

      }

}

 

1.4    

using (FbCommand insertData = conn.CreateCommand())

                {

                    insertData.CommandText = "insert into Table_MouCH values (@id, @name)";

                    insertData.Parameters.Clear();

                    insertData.Parameters.Add("@id", FbDbType.Integer).Value = 10;

                    insertData.Parameters.Add("@name", FbDbType.VarChar, 200).Value = "  ";

                    insertData.ExecuteNonQuery();

                }

 

1.5    

using(FbCommand selectData = conn.CreateCommand())

                {

                    selectData.CommandText = "select * from Table_MouCH";

                    using(FbDataReader r = selectData.ExecuteReader())

                    {

                        while(r.Read())

                        {

                            //string str_Temp = r.GetString(0);

                            string str_Temp = r.GetString(1);

                            MessageBox.Show(str_Temp);

                        }

                    }

                }

 

        :

(1)       FDB        ?              ?

(2)       FDB              !       !

          ???

 

2010-6-13         

  :http://www.jocw.cn/sxsoftservice/Article_Print.asp?ArticleID=780







   :

static string GetConnectionString()

        {

            FbConnectionStringBuilder cs = new FbConnectionStringBuilder();

            cs.Database = "     .fdb";

            cs.UserID = "SYSDBA";

            cs.Password = "masterkey";

            //cs.Charset = "UTF8"; //         ,                            

            cs.ServerType = FbServerType.Embedded; //            

            return cs.ToString();

        }

 

2010-6-13            

                        gb2312  。

       :

private void btn_ChTest_Click(object sender, EventArgs e)

        {

            using (FbConnection conn = new FbConnection(GetConnectionString()))

            {

                conn.Open();

                using (FbCommand createTable = conn.CreateCommand())

                {

createTable.CommandText = "create table Table_MouCH (id int, name varchar(200) character set gb2312)";

                    createTable.ExecuteNonQuery();

                }

                using (FbCommand insertData = conn.CreateCommand())

                {

                    insertData.CommandText = "insert into Table_MouCH values (@id, @name)";

                    insertData.Parameters.Clear();

                    insertData.Parameters.Add("@id", FbDbType.Integer).Value = 10;

                    insertData.Parameters.Add("@name", FbDbType.VarChar, 200).Value = "  ";

                    insertData.ExecuteNonQuery();

                }

                using(FbCommand selectData = conn.CreateCommand())

                {

                    selectData.CommandText = "select * from Table_MouCH";

                    using(FbDataReader r = selectData.ExecuteReader())

                    {

                        while(r.Read())

                        {

                            //string str_Temp = r.GetString(0);

                            string str_Temp = r.GetString(1);

                            MessageBox.Show(str_Temp);

                        }

                    }

                }

            }

            MessageBox.Show("OK3!");

        }