如何修复这个错误?vb.net

发布于 2024-08-14 07:08:45 字数 570 浏览 2 评论 0原文

这是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

淡笑忘祈一世凡恋 2024-08-21 07:08:45

我建议您下载 MySQL 的 ADO.NET 标准驱动程序,而不是 ODBC,并使用它像这样:

Dim connectionString As String = "Server=localhost;Database=my school;Uid=myUsername;Pwd=myPassword;"
Using conn As New MySqlConnection(connectionString)
    Using da As New MySqlDataAdapter("SELECT IDNUMBER, LASTNAME, FIRSTNAME, MIDDLENAME COURSE FROM students", conn)
        conn.Open()
        ' Do something with the results

    End Using
End Using

Instead of ODBC I would suggest you downloading the ADO.NET standard driver for MySQL and use it like this:

Dim connectionString As String = "Server=localhost;Database=my school;Uid=myUsername;Pwd=myPassword;"
Using conn As New MySqlConnection(connectionString)
    Using da As New MySqlDataAdapter("SELECT IDNUMBER, LASTNAME, FIRSTNAME, MIDDLENAME COURSE FROM students", conn)
        conn.Open()
        ' Do something with the results

    End Using
End Using
凉风有信 2024-08-21 07:08:45
“驱动程序={MySQL ODBC 3.51 驱动程序};SERVER=localhost;DATABASE=我的学校;”

SQL 服务器:5.1.36

您使用了错误的驱动程序,即用于 MySQL 数据库的驱动程序。你的数据库是SQL Server,所以需要另一个驱动程序;尝试在连接字符串中使用 "Driver={SQL Server}" (只是一个疯狂的猜测...)。

"Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=my school;"

sql server : 5.1.36

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 …).

我是有多爱你 2024-08-21 07:08:45

假设您使用的是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文