我正在尝试使用我的MySQL Web应用程序连接到ASP.NET数据库。我正在进行一个测试,将数据从MySQL数据库绑定到GridView。
这是我的代码:
Dim strMySQLConn As String = "DRIVER={MySQL ODBC 5.1 Driver};Database=database_name;Server=ip_address;UID=username;PWD=password;"
Dim MySQLConn As New OdbcConnection(strMySQLConn)
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim ds As DataSet = New DataSet()
Dim cmdMySQL As New OdbcDataAdapter("SELECT * FROM categorymaster", MySQLConn)
MySQLConn.Open()
cmdMySQL.Fill(ds, "prjs")
gv.DataSource = ds.Tables("prjs").DefaultView
gv.DataBind()
MySQLConn.Close()
End If
End Sub但是,在进行MySQL数据库连接(MySQLConn.Open())时,将返回以下错误:
没有找到IM002ODBC驱动程序管理器数据源名称,也没有指定默认驱动程序
为什么会这样,我怎样才能阻止它的发生?
而且,看到这个错误的可能原因是什么?如果登录凭据不正确,会显示此错误吗?
https://stackoverflow.com/questions/8240050
复制相似问题