Save changes to a database - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Save changes to a database

sap2020sap2020 Posts: 1Member
[b]Hi ,
This is my codes , what I want to do is to save changes to database. [/b]

[color=Blue] Dim connstr As String = "Provider= Microsoft.Jet.OLEDB.4.0;" & _
"Data source = cdbank.mdb"

Dim dt As New DataTable
Dim sqlstr As String = "SELECT * FROM info"



Private Sub SaveToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem1.Click
Dim changes As Integer


Dim dataadapter As New OleDb.OleDbDataAdapter(sqlstr, connstr)
Dim commandbuilder As New OleDb.OleDbCommandBuilder(dataadapter)
dataadapter.Update(dt)
dataadapter.Dispose()
If changes > 0 Then
MsgBox(changes & "changed rows were stored in the database ")
Else
MsgBox("No changes made.")

End If
End Sub[/color]




But when i run the program and i load data from database and want to save the changes i have made i get this error:


[b]
Syntax error (missing operator) in query expression '((code = ?) AND ((? = 1 AND name IS NULL) OR (name = ?)) AND ((? = 1 AND serial IS NULL) OR (serial = ?)) AND ((? = 1 AND software inside IS NULL) OR (software inside = ?)))'.

[/b][color=Red][/color]

I have no idea what this is about !

Anyone here can help
I mostly appreciate

sap2020


Sign In or Register to comment.