Hi
I m learning ASP and am not sure how to get an Sql string to take a
variable in the select query which I could then execute .
Here is the code :
I send MakeEdit.asp the EditNumber thus:
****************************
<FORM ACTION="MakeEdit.asp" METHOD="POST">
<TABLE align = center BORDER=3 cellspacing =1>
<TR>
<TD>Asset Number:</TD>
<TD><INPUT TYPE="Text" NAME="EditNumber"
VALUE=""
SIZE="40" MAXLENGTH="75">
</TD>
</TR>
</TABLE>
*********************************
and in MakeEdit.asp
***** this WORKS ******
strSQL = "SELECT * FROM DeviceTable WHERE AssetNumber = '1142694';"
rsItem.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic,
adCmdText
***** but this DOES NOT WORK ************
Dim rsItem
Dim strEdit
strEdit = Request("EditNumber")
Set rsItem = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM DeviceTable WHERE AssetNumber = " & strEdit
& ";"
rsItem.Open strSQL, objConn, adOpenKeySet, adLockPessimistic,
adCmdText
***********************
the error i get is explained here.. but i dont know how to solve it .
http://www.adopenstatic.com/faq/80040e07.asp
Thanks
Avik