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!

Empty Recordset problem

Status
Not open for further replies.

slechols

Programmer
Nov 28, 2001
28
US
I have some code where I am populating a drop down box using dynamic variables. "Selection" could be one of four options, depending on which previous drop down box was selected, and "criteria" is the variable selected from that drop down box. The session variables are populated correctly, but it is retrieving an empty recordset. Am I coding this correctly? Thanks in advance.

criteria=Session("criteria")
selection=Session("selection")
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("scrubbed.mdb")
set conn = server.createobject("adodb.connection")
set rs2= server.createobject("adodb.recordset")
conn.open strconn
strsql="Select nsn from scrubbed_data where '"& selection &"' = '"& criteria &"' order by nsn;"
rs2.open strsql, conn, 2, 2

 
the error is in ur query
remove the single codes from the search field variable
even u put that in run time. u need not put the single codes for the fiedls.u must put single codes for the search variables
other wise everything is correct
here the corrected query for u

strsql="Select nsn from scrubbed_data where "& selection &" = '"& criteria &"' order by nsn"
rs2.open strsql, conn, 2, 2

try this and make ur program execute successful
with regards
raghu(webspy)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top