 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 20th, 2004, 01:30 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Incorrect syntax......
Hi there
I've got a varchar column in my SQL db - when I go to insert some data I get an error like this:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 've'.
This is because it is stopping at the ' chararcter (I'm guessing that it thinks the rest of the statement is being commented out) - how do I get round this so that it doesn't think that the rest of the statement is being commented out?
thanks
Adam
|
|

June 20th, 2004, 07:20 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
you need to use the Replace() function and replace all single quotes with two single quotes.
Repalce(YourString,"'","'')
Stilll,if you are having any problems,
Response.Write(yourSQLStatement) and post it.
|
|

June 21st, 2004, 05:44 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Adam,
Can you post the code here, so as to find where you go wrong?
Cheers!
_________________________
-Vijay G
 Strive for Perfection 
|
|

June 21st, 2004, 06:51 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sure
it's a stored procedure and this is the asp code I'm using for it:
set strSQL = con.execute("[up_insert_sale] '" & strSale & "' ,'" & strCondition & "' , '" & intPrice & "' , '" & strDetails & "' , '" & strName & "' , '" & strEmail & "' , '" & strLocation & "' , '" & strDateNow & "' , '" & Deleted & "'")
thanks
|
|

June 21st, 2004, 07:29 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Adam,
You are making mistake there by trying to set the result of con.execute() to strSQL.
It should be written this way.
Code:
set strSQL = "[up_insert_sale] '" & strSale & "' ,'" & strCondition & "' , '" & intPrice & "' , '" & strDetails & "' , '" & strName & "' , '" & strEmail & "' , '" & strLocation & "' , '" & strDateNow & "' , '" & Deleted & "'"
Response.write strSQL
response.end
con.execute(strSQL)
But I foresee that the code marked in RED should be causing problem, as you are trying to enclose intprice within quotes in first case. Not sure if Deleted is BIT type or INT type. Post details on these two COLUMN's DATA TYPES
And post the resulting SQL statement here. That should show what goes wrong.
Cheers!
_________________________
-Vijay G
 Strive for Perfection 
|
|

June 21st, 2004, 10:33 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
When I copy your code there and do a response.write I get this error:
Microsoft VBScript runtime error '800a01a8'
Object required: '[string: "[up_insert_sale] 'ad"]'
where ad is the text that I added in the text field.
intPrice is a varchar column and Deleted is bit.
thanks
Adam
|
|

June 21st, 2004, 10:45 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
That is because, you are missing "EXECUTE" word there.
It should be
strSQL = "Execute up_insert_sale .....
Remove SET keyword there.
If you say up_insert_sale is a stored proc.
Cheers!
_________________________
-Vijay G
 Strive for Perfection 
|
|

June 21st, 2004, 11:11 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
great, thanks Vijay
|
|

June 21st, 2004, 11:14 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Welcome! Actually I didnot notice that you were missing EXECUTE the previous time;).
Cheers!
_________________________
-Vijay G
 Strive for Perfection 
|
|
 |