C#でConnector/Net 6.9.9を使ってMySQLに接続する方法

1.Connector/Netのダウンロード

http://dev.mysql.com/downloads/connector/net/

2.web.configの設定

<configuration
<connectionStrings>
<addname=”MysqlConnection”connectionString=”server=localhost;userid=root;password=pwdstartnews24;database=dbstartnews24;”/>
</connectionStrings>
</configuration
3.MySQLに接続するコード
string sqlstring = System.Configuration.ConfigurationManager.ConnectionStrings[“MysqlConnection”].ConnectionString;
MySqlConnection myconn=new MySqlConnection(sqlstring);
myconn.Open();

Comments are closed.