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

Dealing with the Request Object 1

Status
Not open for further replies.

millzy7

Programmer
Dec 9, 2003
96
US
Hi,

I'm trying to create a query based on the users input. However the query falls over if i add the value of Request.Form("SongChoice") to the query. The value expected in the query is a long integer. If i explicitly set songid to 6 in the code then the query works. I just need to know how to convert the raw value returned by Request.Form("SongChoice") to a long integer that the query expects.

Thanks

Millzy

<%
dim dbconn,sql,dbcomm,dbread, dbpath, songid
songid = Request.Form("SongChoice")
dbpath = "TestDB.mdb"
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & dbpath)
dbconn.Open()
sql="SELECT * FROM tblSongs where id =" & songid
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
%>
 
Also, what exactly is "SongChoice". Why do you have to get it's value via Request.Form?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
If you mean you are using a RadioButtonList server control, then you should access the selected item via "RadioButtonList1.SelectedItem.Value". It's very rarely that you will have to access objects via Request.Form.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top