When i run my program there's an error in
conn.open()
and tells "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."
Please help me to solve this problem...
Here's my code:
Dim ds As New DataSet
Dim dbSource As String
Dim dbProvider As String
Dim conn As New OleDb.OleDbConnection
Dim dbcursor As Integer = 0
Dim da As New OleDb.OleDbDataAdapter
Dim cmdUpdate As New OleDb.OleDbCommand
Dim msg1 As String
Dim style As MsgBoxStyle
Dim result As MsgBoxResult
If conn.State = ConnectionState.Open Then
GoTo cont
Else
If conn.State = ConnectionState.Closed Then
dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
dbSource = "data source=.\sqlexpress; integrated security = true; attachdbfilename=|datadirectory|\database.mdf; user instance = true;"
conn.ConnectionString = dbProvider & dbSource
conn.Open()
da.SelectCommand = New OleDb.OleDbCommand("SELECT * FROM table1 WHERE id like '%" + "%'")
da.SelectCommand.Connection = conn
Dim mycomand As New OleDb.OleDbCommandBuilder(da)
da.Fill(ds, "table1")
cont: cmdUpdate.CommandText = "UPDATE table1 " & _
"SET Processor = '" & TextBox2.Text & "'" & _
", Memory = '" & TextBox3.Text & "'" & _
", VideoCard = '" & TextBox4.Text & "'" & _
", HardDrive = '" & TextBox5.Text & "'" & _
", AntiVirus = '" & TextBox6.Text & "'" & _
cmdUpdate.CommandType = Data.CommandType.Text
cmdUpdate.Connection = conn
cmdUpdate.ExecuteNonQuery()
cmdUpdate.Dispose()
conn.Close()
msg1 = "updated successfully."
result = MsgBox(msg1, style)
'Catch
MessageBox.Show("An error occured while updating!")
'End Try
End If
End If