System.Data.Sqlclient.Sqlexception: Line1 incorrect syntax ...
Posted
by marocanu2001
on Geeks with Blogs
See other posts from Geeks with Blogs
or by marocanu2001
Published on Thu, 25 Mar 2010 14:36:12 GMT
Indexed on
2010/03/25
15:53 UTC
Read the original article
Hit count: 190
Given a SqlConnection, a SqlCommand if you need to execute a stored procedure it is enough to specify the stored procedure name as the CommandText and it will work.
Now the surprise is that if you also add parametres, you get this creepy error: SqlException: Line 1 incorrect syntax near [storedProcedureName].
The quick fix is to specify the CommandType to be StoredProcedure.
© Geeks with Blogs or respective owner