'Line 1: Invalid syntax near' in ASP.Net
The other day while working on an ASP.Net website with some simple ADO.Net CRUD functionality, I was getting the most frustrating error.

"Line 1: Invalid syntax near 'spMyProcedureName'." But I ran the stored procedure in Query Analyzer, and it worked fine.

Typically my response is to go to the web, but a search on the error message turned up only people with the same question - and no answers that worked for my situation.

After much searching through code, and admittedly some yelling, it finally came to me what the problem was: I had not set the command type to 'StoredProcedure' on the command object.

Dang literal computers.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Comments

# re: 'Line 1: Invalid syntax near' in ASP.Net
Gravatar You're certainly not the first person to do that. It's been awhile for me, but wasn't ADO classic more forgiving about that?
Left by Jeremy on 8/13/2005 11:44 AM
# re: 'Line 1: Invalid syntax near' in ASP.Net
Gravatar ADO was more forgiving now that you mention it.

Yeah - my 'downfall' was due to the fact that on my big project I use a home grown data wrapper class that set the command type depending on the method you call. On this small (at least it was supposed to be small) project I was just out of the habit, I guess.

That, and the obscure error message.
Left by JT on 8/14/2005 5:49 AM

Leave Your Comment

Title*
Name*
Email (never displayed)
 (will show your gravatar)
Url
Comment*

 

Preview Your Comment.