_cuclife.com
当前位置:cuclife.com > IT > ASP.NET >

c#连接MySql数据库的两种方法

1、用MySQLDriverCS连接

: ((();

: (MyConString);

(query, MyConnection);

+

                                 "SERVER=localhost;" +

                                 "DATABASE=inv;" +

                                 "UID=root;" +

                                 "PASSWORD=831025;" +

                                 "OPTION=3";

          OdbcConnection MyConnection = new OdbcConnection(MyConString);

OdbcDataAdapter oda = new OdbcDataAdapter("select * from customer ", MyConnection);

DataSet ds = new DataSet();

          oda.Fill(ds, "employee");
          this.dataGridView1.DataSource = ds.Tables["employee"];

*/

 

           MyConnection.Close();

        }

    }

}

文章来源:网络整理  本站编辑:兰特
上一篇:C#中读取数据库名,表名,列名
下一篇:解决ASP.NET的进程帐户没有访问IIS的权限
评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)