SQL Delete command ExecuteNonQuery

Joined
Jun 10, 2003
Messages
23
Does anybody know what the syntax is from a delete command when you use for example a value of a textbox (its a DELETE command for an ExecuteNonQuery command)
I tried the following:


Code:
Dim squery As String = " DELETE FROM Table1 WHERE (ID = " & textbox1.Text & ")"

I hope someone can help

Martijn
 
Code:
Dim sQuery As String = "DELETE FROM [Table1] WHERE [Table1].[ID] = " & TextBox1.Text.Replace("", "") & ""
... should work just fine assuming that the field "ID" was defined in the table as a string or character value.
 
Code:
Dim Squery As String = "Delete FROM Table1 WHERE ID=" & txtBox.Text

Thats what works for me, I was trying ID = ID NUMBER but never got it working had to the remove both for it to work properly. Am using office 2000 dont know if that has anything to do with it
 
If the ID field is of numeric type then ....

Dim Squery As String = "Delete FROM Table1 WHERE ID=" & convert.toint32(txtBox.Text)
 
Thanks, I tried it with



Code:
Dim sQuery As String = "DELETE FROM Table1 WHERE ID = "&
txtBox.Text

And it works for strings and integers

Goodbye, Martijn
 
Dim squery As String = " DELETE FROM Table1 WHERE ID = " & textbox1.Text & ""


This should work. Try this.

all the best.
 
Back
Top