I m trying to connect to a MySQL database using my ASP.NET Web Forms Application. I m carrying out a test to Bind the data from the MySQL database to a 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(
)时,将下列错误退回:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Why is this and how can I prevent it from happening?
而且,看到这一错误的可能原因是什么? 如果 log证书不正确,是否会显示这一错误?