Hi THERE
I have made an application in VB.net 2003.
I have a button to update a table in Ms access .
When I give a string from the text box as parametr for the the where clause. I get a syntex error.
For example
On the Textbox in my form I give a value 1693
on the click of the button.
i get Syntex error in data in querry expression 'LD=# 1693#"
LD is a text field in my access table
My code is as seen below. Not sure if I'm passing the string correctly. Please advice.
Private Sub YesToALLLoadBTN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles YesToALLLoadBTN.Click
Try
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\TEXASSCH\WACO USE.mdb"
Dim myConnection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection
myConnection.ConnectionString = connString
myConnection.Open()
Dim stSQL As String = "UPDATE [USER ENTRY] SET ShipYes = 0 where LD = #" & OTBOX.Text & "# "
Dim cmd As New System.Data.OleDb.OleDbCommand(stSQL, myConnection)
cmd.ExecuteNonQuery()
myConnection.Close()
Catch ex As Exception
'MsgBox(" The Changes That You Made To Missed Order Has Been Saved")
MsgBox(ex.Message + vbCrLf + ex.Source & vbCrLf & vbCrLf & ex.StackTrace, MsgBoxStyle.Critical, "Error")
End Try
End Sub
stSQL = "UPDATE [USER ENTRY] SET ShipYes = 0 where LD = '" & OTBOX.Text & "'"