ConnectionString for SQL Server

本文关键字:Server SQL for ConnectionString | 更新日期: 2023-09-27 17:49:14

我的电脑已经安装了xampp。我试图访问数据与ADO.Net。我使用的连接字符串如下所示:

string connectionString = "Server = localhost; Database = magento; User Id = magento; Password = abcd;";
SqlConnection con = new SqlConnection(connectionString);
string cmdString = "SELECT date_added,title,description,url FROM adminnotification_inbox";
SqlDataAdapter da = new SqlDataAdapter(cmdString, con);
ds = new DataSet();
da.Fill(ds,"prog");
dt = ds.Tables["prog"];
currRec = -1;
totalRec = dt.Rows.Count;
button3.Enabled = true;

我能够在phpmyadmin中使用上述用户id和密码登录,但无法使用上述连接字符串访问数据库。请帮助。

ConnectionString for SQL Server

MySQL有自己的ADO。. NET连接器:http://dev.mysql.com/downloads/connector/net/6.6.html#downloads

如果你使用它,你可以创建一个MySqlConnection: http://dev.mysql.com/doc/refman/5.5/en/connector-net-tutorials-intro.html

基本的SqlConnection用于Microsoft自己的SQL Server产品。

9-22-14 -希望其他人也能看到:

你需要一个驱动程序在你的连接字符串我相信。"MySQL ODBC 3.51 Driver"是windows的驱动程序名。

string connectionString ="Driver={MySQL ODBC 3.51 Driver};服务器=…把连接字符串的剩余部分放在这里

注意:这是使用MS Access VBA连接MySQL数据库的字符串: