megha
megha

Reputation: 1

Configuring server connection with database in vb.net

I am connecting to the MS Access server with the following code.

Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=162.222.225.78;Database=CRM.mdb;Integrated Security=SSPI;User ID=corpopef;Password=********;")
Dim cmd As New OleDb.OleDbCommand
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If
cmd.Connection = cnn
cmd.CommandText = "INSERT INTO Addressbook(srno) " & _
"VALUES('" & Me.TextBox1.Text & "')"
cmd.ExecuteNonQuery()

But it results in the following error: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done." Please suggest to me some methods to work around this problem.

Thanks in advance...!

Upvotes: 0

Views: 73

Answers (1)

Alireza
Alireza

Reputation: 5056

The connection string you used seems like an SQL client connection string. For an access database, you should use this format:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=path_to_mdb_file\CRM.MDB;User Id=user_id; Password=password;

Upvotes: 1

Related Questions