sql error
-
Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?
-
Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?
Use stored procs
only two letters away from being an asset
-
Use stored procs
only two letters away from being an asset
What does it mean?
-
What does it mean?
You don't know what stored procedures are? :omg: :sigh:
only two letters away from being an asset
-
You don't know what stored procedures are? :omg: :sigh:
only two letters away from being an asset
No
-
No
Then go away and don't come back until you do. :rolleyes:
only two letters away from being an asset
-
Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?
That depends on the query. It's not really that the query is too long, but probably that the DataAdapter will only work with queries that return data from a single table with a primary key.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?
michaelgr1 wrote:
dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring);
Did you put one too many new lines after that = statement? at most the assignment should be the next line down, you shouldn't add any space between the 2 lines.
-
michaelgr1 wrote:
dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring);
Did you put one too many new lines after that = statement? at most the assignment should be the next line down, you shouldn't add any space between the 2 lines.
I am BATMAN wrote:
at most the assignment should be the next line down
Not according to the language spec. You can have as many white space chars as you like including multiple newlines. :) I've just checked with a prog by adding multiple newlines - compiles without error. :)
Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis
-
Hello, I use dataadapter to fill datagrid (using datatable). dataAdapter = new SqlDataAdapter(selectcommand3, connectionstring); But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?
if what you say in currect you can use @"" string style: SqlCommand mySqlComm = new SqlCommand(); mySqlComm.CommandText = @" type your string here "; but I think your sql statement is incorrect. Copy your SqlCommandText and paste in in sql Query analyzer and test it. if it has not that error what you said it correct.