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()
%>
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()
%>