嗨,我试图通过 VB 访问 MS ACCESS DB,但出现此错误 ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
我已经做好了:
- 将 IIS 管理器 - 应用程序池 App32 位更改为 true
- 为 Access 下载的数据库驱动程序
- 安装访问客户端
目前没有任何工作,我已经尝试了 2 台不同的计算机
这是我的代码
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 处理 Button1.Click
Dim vConnectionStringX As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\1767631\db_Assign_2.accdb;Persist Security Info=False;"
Dim rtfConn As New Data.Odbc.OdbcConnection(vConnectionStringX)
rtfConn.Open()
Dim cusFName As String = TextBox1.Text
Dim cusLName As String = TextBox2.Text
Dim cusTP As String = TextBox3.Text
Dim cusEmail As String = TextBox4.Text
Dim vSQL As String = "Insert into Customer(FirstName, LastName, Telephone, Email) Values (" & cusFName & "," & cusLName & "," & cusTP & "," & "cusEmail"")"
Try
Dim rtfSQLCMD As New Data.Odbc.OdbcCommand
rtfSQLCMD.Connection = rtfConn
rtfSQLCMD.CommandText = vSQL
Dim vResult As Integer = rtfSQLCMD.ExecuteNonQuery
MessageBox.Show("Customer registered! " & vResult)
Catch ex As Data.Odbc.OdbcException
Dim vErMsg As String = "*** Error occured while registering the customer ***" & ControlChars.NewLine
End Try
rtfConn.Close()
End Sub
请帮助我!