|
-
Nov 13th, 2000, 01:21 AM
#1
Thread Starter
New Member
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
-
Nov 13th, 2000, 03:19 AM
#2
Fanatic Member
Correct Syntax
strSql = "SELECT * FROM Person WHERE ssn = ' " & S_ssn & " ' "
Look at the single and double quotes.
Cheers
Ray
-
Nov 13th, 2000, 02:26 PM
#3
Thread Starter
New Member
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
-
Nov 14th, 2000, 02:06 AM
#4
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|