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

displaying records from table using checkbox value

Status
Not open for further replies.

oops4me

Programmer
Jul 7, 2003
50
IN
Hello,

I want show records in .asp page. in page i collecting checkbox values which are submited to this .asp page. i am storing that values in one variable & passing that to query. but i am getting an error can anybody tell me how to do it. i have written following code.

dim strIDS

strIDs = Replace(Request.Form, "&chk1=", ",")
strIDs = Replace(strIDs, "chk1=", "")

set con = Server.CreateObject("ADODB.Connection")
mydb = Server.MapPath("db/trycera.mdb")
con.mode=adModeReadWrite
con.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& mydb &";Persist Security Info=False"
con.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& mydb &";Persist Security Info=False"
set rs=con.execute("select * FROM ulogin WHERE username IN (" & strIDs & ")")

chk1 is name of checkbox values i am taking checkbox values from another page.

there is problem in query only,how to write please tell me.please give me the code

 
Assuming that your ADO connection is working properly...

Replace these two lines:

strIDs = Replace(Request.Form, "&chk1=", ",")
strIDs = Replace(strIDs, "chk1=", "")


With this:
Code:
strIDs = Request.Form("chk1")
if (Len(strIDs) = 0) then
  Response.Write "Input error"
  Response.End
end if
 
hello, i have make the changes as u told but it's not working it is giving me error at line where i have given sql query. just see my which i have written as below

<!-- #include file="adovbs.inc"-->
<%
strIDs=request.form("chk1")
set con = Server.CreateObject("ADODB.Connection")
mydb = Server.MapPath("db/trycera.mdb")
con.mode=adModeReadWrite
con.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& mydb &";Persist Security Info=False"
con.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& mydb &";Persist Security Info=False"
set rs=con.execute("select * FROM ulogin WHERE username IN " &"(" & strIDs & ")" )
rs.close
rs.locktype = adlockoptimistic
rs.cursortype = adopendynamic
rs.cursorlocation = aduseclient
rs.open
while not rs.eof
response.write (rs.fields("username"))
response.write(rs.field("verification"))
response.write(rs.fields("productid"))
rs.movenext
wend

%>
just see the code & tell me the changes.in this strIDs is contains usernames (in format like aaa,bbb,ccc). i have to show records of these users.

please tell me the code
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top