I have been getting the following error when I run some VBScript code on an
ASP page that modifies values in a SQL Server 2000 database:
Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 3: Incorrect syntax near
','. /manProds.asp, line 185
POST Data:
bayID=105700112&bayName=Another+New+Test+Today&baycat=Laptops&baysubcat=Database+SW&bayPicture=Illustration+Not+Available&bayPrice=35.58&bayBriefDesc=another%0D%0A%09%09%09&bayFullDesc=Product+Descrip . . .
This same code worked fine w/ SQL7, but for some reason won't work w/
SQL2000. The code is as follows:
<%
IF addProduct <> "" THEN
sqlString = "INSERT INTO bayServ " &_
"( bay_name, bay_cat, bay_subcat, bay_picture, " &_
"bay_price, bay_briefDesc, " &_
"bay_fullDesc, bay_status ) VALUES ( " &_
" '" & fixQuotes( bayName ) & "', " &_
" '" & ( bayCat ) & "', " &_
" '" & ( baySubCat ) & "', " &_
" '" & fixQuotes( bayPicture ) & "', " &_
bayPrice & ", " &_
" '" & fixQuotes( bayBriefDesc ) & "', " &_
" '" & fixQuotes( bayFullDesc ) & "', " &_
bayStatus & " )"
bayDB.Execute sqlString
%>
...(redacted web code)
<%
END IF
IF updateProduct <> "" THEN
sqlString = "UPDATE bayServ SET " &_
"bay_name='" & fixQuotes( bayName ) & "'," &_
"bay_picture='" & fixQuotes( bayPicture ) & "'," &_
"bay_price=" & cCUR( bayPrice ) & "," &_
"bay_cat='" & fixQuotes( bayCat ) & "'," &_
"bay_subcat='" & fixQuotes( baySubCat ) & "'," &_
"bay_briefDesc='" & fixQuotes( bayBriefDesc ) & "'," &_
"bay_fullDesc='" & fixQuotes( bayFullDesc ) & "'," &_
"bay_status=" & bayStatus &_
"WHERE bay_id=" & bayID
bayDB.Execute sqlString
%>
The last bayDB.execute.sqlString is line 185. I've included the addProduct
snippet because it works just fine, but maybe the problem is passed from
there--I don't know. From what the error notes, I'm guessing the problem
might be w/ the variable bayPrice, which is defined as type 'money.' But
everything I've done to try to fix it returns the same error. The post data
string suggests it might be a problem w/ bayBriefDesc, but I can't see any
problem w/ how I have it set up in the code (and after all, it works fine in
fine in addProduct). The FixQuotes function is as follows:
FUNCTION fixQuotes( theString )
fixQuotes = REPLACE( theString, "'", "''" )
END FUNCTION
I can't figure out what exactly the problem is, and would much appreciate it
if someone could review my code and let me know what I might have done wrong
or what I could possibly do to fix it. TIA...
ba