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

NEED TO QUERY AN INTEGER IN AN SQL COMMAND IN ASP

Status
Not open for further replies.

aviles22

Programmer
Jun 27, 2000
25
US
I AM EXPERIENCED IN ASP AND SQL QUERYING BUT THIS LITTLE PROBLEM IS GETTING TO MY HEAD!

I AM USING THIS CODE ON AN ASP PAGE!

HOW CAN I DO THIS!

TempID = 18
oRS.Open "SELECT * FROM Employees Where ID = TempID

I'VE TRIED '" &TempId& "'
among others please give me the correct format, Thanks!
 
depends on what format the data is in the database -- your title indicates it's an integer, but you are trying to use the ' tick marks to set it off like it was a string.

You were on the right track with the & operator -- you might take it a step further by placing the SQL statement into a variable first, and then using that to open the recordset --

sqlString = "SELECT * FROM Employees Where ID = " & TempID
oRS.Open sqlString

don't use the ticks if it's an integer (or number) value in the database --

hope it helps! :)
Paul Prewett
 
tempid = 18
oRS.open "select * from employees where id=" & tempid

if tempid is a varchar in the table then
oRS.open "select * from employees where id='" & tempid & "'"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top