Results 1 to 3 of 3

Thread: Little help please

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2003
    Posts
    1

    Unhappy 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.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    String criterias need to be surrounded by single quotes.
    When building the string dynamically, concatenate the values from your controls or variables.
    VB Code:
    1. 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.

  3. #3
    Addicted Member myrrdan's Avatar
    Join Date
    Nov 2002
    Location
    Alberta Canada
    Posts
    202
    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
  •  



Click Here to Expand Forum to Full Width