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

ASP/SQL error

Status
Not open for further replies.

MWIT

IS-IT--Management
Nov 13, 2002
1
CA
I'm trying to pull data with asp from a sql server. Everything works ok except in one feild if i type 0232332aa or any combination of letters and numbers i get an error from the webpage, then can't get back into edit the number through my webpage. I'm running IIS with SQL2k.
This is the error i get...

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'aa'.
/quarantine/new/quarantine_edit.asp, line 148


I have tried to set the datatype to char, text, numeric and nothing seems to work. If i look at my asp code i don't see an error at line 148 my code there looks like this...

if (Request.Form(&quot;saveid&quot;)<>&quot;&quot; and Request.Form(&quot;action&quot;)=&quot;edit&quot;) then
strSQL=&quot;update &quot; & strTableName & &quot; set &quot;
For i = 1 To Request.Form(&quot;FieldName&quot;).Count
if Request.Form(&quot;Updatable&quot;)(i)<>&quot;True&quot; then _
i=i+1

strSQL=strSQL & AddWrappers(Request.Form(&quot;FieldName&quot;)(i)) & &quot;=&quot;
' boolean
if Request.Form(&quot;FieldType&quot;)(i)=&quot;11&quot; then
if Request.Form(Request.Form(&quot;FieldName&quot;)(i))=&quot;on&quot; then
strValue=&quot;1&quot;
else
strValue=&quot;0&quot;
end if
else ' not boolean
if (Request.Form(&quot;NeedQuotes&quot;)(i))=&quot;True&quot; then
strValue= &quot;'&quot; & Replace( Request.Form(Request.Form(&quot;FieldName&quot;)(i)) , &quot;'&quot;, &quot;''&quot;) & &quot;'&quot;
else
if Request.Form(Request.Form(&quot;FieldName&quot;)(i))=&quot;&quot; then
strValue=&quot;0&quot;
else
strValue=Request.Form(Request.Form(&quot;FieldName&quot;)(i))
end if
end if
end if

I don't see what is wrong, am i missing some little mistake?

Thanks for any help.
 
>> I don't see what is wrong, am i missing some
>> little mistake?

Yes, you are not seeing the SQL statement. Send it to the browser so you can actual see what you have built with all that string concatination code.

-pete
 
I think your geting the below error:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'aa'.
/quarantine/new/quarantine_edit.asp, line 148

Because you need to include single quotes around the 0232332aa like '0232332aa' &quot;did you just say Minkey?, yes that's what I said.&quot;

MrGreed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top