|
-
Dec 9th, 2003, 03:32 PM
#1
Thread Starter
New Member
Little help please
I've set up a little program to aid me at work. I've used to know some of these things when I was still in school but off course they are now forgotten. I'm using an ordinary db connection using SQL statements to select the data. But now I need to remove a record and it comes with criteria. So I thought something like this should do the trick:
ssql = "delete * from order where titel = lblTest.Caption"
I do think that lblTest.Caption shouldn't be included within the " because it isn't a constant and neither a string.
And after setting the SQL statement I then execute it.
rs.Open ssql, madoCon, adOpenStatic
I hope this is enough information to help me a little bit forward cause I really am looking forward to using this program at work.
Anyhow Thx for any hints or solutions.
-
Dec 9th, 2003, 03:43 PM
#2
String criterias need to be surrounded by single quotes.
When building the string dynamically, concatenate the values from your controls or variables.
VB Code:
ssql = "delete * from order where titel = '" & lblTest.Caption & "'"
For efficiency reasons, don't use a recordset to execute action queries (Insert, Update and Delete statements). Execute them via the ADO Connection.Execute or Command.Execute methods.
-
Apr 13th, 2004, 09:55 AM
#3
Addicted Member
For efficiency reasons, don't use a recordset to execute action queries (Insert, Update and Delete statements). Execute them via the ADO Connection.Execute or Command.Execute methods.
i'm not sure wha tyou mean by this..
can you give me an example of what you mean?
Oooops.....theres another semi-colon in the wrong spot....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|