如何修复这个错误?vb.net
这是 vb.net 的屏幕截图: http://www.mypicx.com/12132009/ers/
这是我的代码:
Dim connectionString As String = "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=my school;" '
Dim conn As New OdbcConnection(connectionString)
conn.Open()
Dim da As New OdbcDataAdapter("SELECT IDNUMBER, LASTNAME, FIRSTNAME, MIDDLENAME COURSE FROM students", conn)
conn.Close()
-我想做的就是将wamp服务器与vb.net连接,这是wamp服务器
sql服务器中的版本:5.1.36
Here is the screen shot of the vb.net:
http://www.mypicx.com/12132009/ers/
And here is my code:
Dim connectionString As String = "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=my school;" '
Dim conn As New OdbcConnection(connectionString)
conn.Open()
Dim da As New OdbcDataAdapter("SELECT IDNUMBER, LASTNAME, FIRSTNAME, MIDDLENAME COURSE FROM students", conn)
conn.Close()
-All I want to do is to connect wamp server with vb.net, here is the version in wamp server
sql server : 5.1.36
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议您下载 MySQL 的 ADO.NET 标准驱动程序,而不是 ODBC,并使用它像这样:
Instead of ODBC I would suggest you downloading the ADO.NET standard driver for MySQL and use it like this:
您使用了错误的驱动程序,即用于 MySQL 数据库的驱动程序。你的数据库是SQL Server,所以需要另一个驱动程序;尝试在连接字符串中使用
"Driver={SQL Server}"
(只是一个疯狂的猜测...)。You are using the wrong driver, namely one for a MySQL database. Your database is a SQL Server, so another driver is needed; try
"Driver={SQL Server}"
in the connection string instead (only a wild guess …).假设您使用的是 MySQL 5.1.36 而不是 SQL Server 5.1.36(在这种情况下确实需要升级),那么您可能需要安装 MySQL Connector/NET,这些驱动程序可让您从 .NET 应用程序连接到 MySQL 数据库。
然后,您还可以使用本机 MySQL 数据类,例如 MySqlConnection,而不是通用的 OdbcConnection。
Assuming you're using MySQL 5.1.36 and not SQL Server 5.1.36 (in which case it's really time for an upgrade) then you probably need to install MySQL Connector/NET, these are the drivers that will let you connect to a MySQL database from a .NET application.
You'll then also be able to use the native MySQL data classes, such as MySqlConnection instead of the generic OdbcConnection.