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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with 1 line of code~ ASP/ADO/SQL

Status
Not open for further replies.

SSJpn

Technical User
Oct 7, 2002
259
US
I have a page linked to a MS Access DB. I have a form where a user enters a name then I want all the records in my database matching that name to show up on the web. I can't figure out how to get this piece of code right

rs.Open "Select * from EOB WHERE FirstName = First_Name", conn

EOB is my table name
FirstName is the name if the Field
First_Name is a variable that has been assigned the text from the textbox on the previous page.

Normally you would have the single quotes around 'First_Name' but I'm not looking for 'First_Name' literally so I tried taking off the single quotes but it doesnt work.

I think this is a very easy fix? anyone help pls. Thx

Kevin.
 
Kevin, the string in ur code must end up being exactly as it would be if u wrote the query in MSAccess

"Select * from mytable where name = 'Kevin'"

That's what u need yes? so u must build that string using the value of ur variable First_Name to fill in the characters in that part of the string.

"Select * from mytable where name = '" & First_Name & "'" -There are only 10 types of people in the world, those who understand binary and those who don't-

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top