database - What is the missing operator in my command? -


my program works perfectly, problem when database has been updated, alert box appear saying:

syntax error (missing operator) in query expression 'id='.

 private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click     dim choice string     choice = msgbox("do want delete?", msgboxstyle.yesno)     if choice = vbyes         cnn = new oledb.oledbconnection("provider=microsoft.ace.oledb.12.0;data source=database.accdb")         dim str string = ("delete tablename id= " & combobox1.text & "")         command = new oledb.oledbcommand(str, cnn)         da = new oledb.oledbdataadapter(command)         cnn.open()         command.executenonquery()         form1.timer1.enabled = true         clearfields()         form1.timer1.enabled = false         me.close()     end if      cnn.close()  end sub 

it says error located here: (id autonumber.)

dim str string = ("delete tablename id= " & combobox1.text & "") 

thank much!

dim str string = ("delete tablename id= '" & combobox1.text & "'") 

you need single quotes value


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -