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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.