Results 1 to 3 of 3

Thread: SQL, ADODC ???

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    43

    Post

    Hi, Anyone can help me with this problem?
    Currently I'm using ADODC connecting to access. But When i key in the following SQL text, I encounter some problem when i tried both of them, Pls guide me.

    Ven - table name
    Field1 - Row

    (Tried) Code:

    Select * FROM Ven WHERE Ven.Field1= "'& Text3.Text & '"

    Select * FROM Ven WHERE Field1 = "'& Text3.Text & '"

    Both can't work, Is the quotes right?
    double quotes comes first then single quote ???

    Or is there any another way??
    Thks & regards.

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    Hi,

    "Select * FROM Ven WHERE Ven.Field1='" & Text3.Text & "'"

    [Double Quote]Select * FROM Ven WHERE Ven.Field1=[Single Quote][Double Quote][Space]&[Space]Text3.Text[Space]&[Space][Double Quote][Single Quote][Double Quote]

    Hope this helps,

    Preeti

  3. #3
    Member
    Join Date
    Apr 1999
    Location
    Kirkland, WA, USA
    Posts
    40

    Post

    You'll make your life a lot easier if you stop using single quotes altogether. Use chr(34) instead like:

    "SELECT tbl.Fld1 FROM tbl WHERE tbl.Fld2 = " & chr(34) & sCriteria & chr(34)

    or

    "SELECT tbl.Fld1 FROM tbl WHERE tbl.Fld2 LIKE " & chr(34) & sCriteria & "*" & chr(34)


    Now you can forget adding double-doublequotes and accidental double-singlequotes plus you can let users put single and double quotes in the actual text of the fields and they can search with single and double quotes included in the criteria.

    Justa thought

    -S

    ------------------
    http://www.smithvoice.com/vbfun.htm

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