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

Incorrect syntax near '='

Status
Not open for further replies.

heathL

MIS
Jan 30, 2003
10
0
0
US
<%
Dim rsWeb
Dim sql
Dim rsWebPKEY
Dim pkey
dim vRecipient, vCC, vBCC, vMailserver
dim oMailer, mtxt, ftxt
dim fso, f
Dim OIRequestType
OIRequestType = request.form(&quot;RequestType&quot;)

sql = &quot;SELECT * FROM tblInformation WHERE pkey=&quot; & request.form(&quot;Pkey&quot;)
Set rsWeb = Server.CreateObject(&quot;adodb.recordset&quot;)
rsWeb.open sql, strCON, 3, 3


if request.form(&quot;Approved&quot;) = &quot;Yes&quot; then
rsWeb(&quot;Approver1&quot;) = &quot;Yes&quot;
rsWeb(&quot;Approver1NTID&quot;) = trim(Request.ServerVariables (&quot;LOGON_USER&quot;))
rsWeb(&quot;DateApprover1&quot;) = date()
rsWeb(&quot;Status&quot;) = &quot;PendingSecurity&quot;
rsWeb.Update
 
Hi,

I think request.form(&quot;Pkey&quot;) is not having any value, either it could be a wrong field name in the previous ASP page or that field is not being set to any value....

Try to check the constructed SQL with reponse.write after the SQL... something like this

sql = &quot;SELECT * FROM tblInformation WHERE pkey=&quot; & request.form(&quot;Pkey&quot;)

Response.write

Hope it helps

Sunil


 
I think you forgot your ' in your sql statement

Try this

sql = &quot;SELECT * FROM tblInformation WHERE pkey= '&quot; & request.form(&quot;Pkey&quot;) & &quot;'&quot;

Hope this will help

Karel
karel.denaeghel@barco.com
 
You would need to add the quotes if the PK column was char data, if not then your original query is correct.

Follow Sunil's advice and Response.Write your SQL statement to see what is actually getting sent to SQL Server and verify that the value is getting picked up properly. --James
 
Thanks to all of you for your responses.

Sunil's suggestion was correct in that I was using the wrong field name. It was so subtle -- I was using Pkey instead of pkey. I really appreciate your help. This forum is Great! Especially for a newbie to SQL like myself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top