Results 1 to 4 of 4

Thread: ado recordsource

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    2
    Hi, I am new to VB database programming, and i have a question.

    I use ADO, the connectionstring is OK, on the RecordSource , I choose 1_adCmdtext, then I input a SQL , such as
    "select * from Person where person.ssn=S_ssn"
    , it do not work,
    here, S_ssn is a public variable, and I also tried such as "select * from person where person.ssn= "'&S_ssn'" "
    , or something like that. it totally don't work. When I put a value("111111111") intead of a S_ssn, it works.

    I want to know How to use a public variable on the Recordsource choice.

    Any Suggestions are welcome!
    velle

  2. #2
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Worldwide in the Sun
    Posts
    566
    Correct Syntax

    strSql = "SELECT * FROM Person WHERE ssn = ' " & S_ssn & " ' "

    Look at the single and double quotes.


    Cheers
    Ray

    Ray

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    2
    Hi, thanks for your advice, I tried , there is no syntax error, however, no result is shown.
    I don't use code to do that, and I just use the ADODC's property page, I put the SQL on the "RECORDSOURCE" under the "1_adcmdtext".

    Is it ONLY can be done using code? not in the property page.

    thanks
    velle

  4. #4
    Addicted Member P.S.W.'s Avatar
    Join Date
    Aug 2000
    Posts
    146
    Yep, using variables with your SQL statement needs to be done in code at run-time. The property pages won't recognize variables.

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