Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

correct syntax for a sql stmnt in asp needed

Status
Not open for further replies.

1712

Technical User
Nov 8, 2000
66
0
0
NL
I have tried a number of ways to check for a constant variable with a database variable.

I am trying to compare the value "Yes" to field1 in a select * from file where field1 = "Yes"

Thanks....I am using frontpage/asp/access db

 
Yes/No fields are true/false fields as value(binary)
This should do
select * from file where field1
or
select * from file where field1 = true


________
George, M
 
George,

Thanks for the quick reply. The field is a text field in my access db. The values in the table are either "Yes" or blank, so I need to treat it like a string.

My problem is I can not seem to get the right syntax to insure it is checking for this value. It appears to ignore it and accept everything.

I just need to know how to check for a constant variable in a sql statement in asp or any other workaround.

 
Ok i understand,
i presume taht you are using this from ASP page and it would need to be

sql="select * from file where field1 like 'Yes'"

Noticed that using Like to compare strings works better then using =
This should work ok.



________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top