troubleshooting Question

Update syntex in a VB.Net when using a string where clause

Avatar of Sivasan
SivasanFlag for United States of America asked on
.NET ProgrammingMicrosoft AccessVisual Basic.NET
6 Comments3 Solutions220 ViewsLast Modified:
I have made an application in 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

            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

                    Dim stSQL As String = "UPDATE [USER ENTRY] SET  ShipYes = 0 where LD =  #" & OTBOX.Text & "# "

            Dim cmd As New System.Data.OleDb.OleDbCommand(stSQL, myConnection)



        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
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 3 Answers and 6 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 3 Answers and 6 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004