procedure
-
I have a button in my form and on click of that button I am writing this code....
OdbcCommand cmd ;
cmd = new OdbcCommand("abc", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();I have made a procedure named abc in database which is returning only one row from login table..So i am just checking that on click of that button my procedure should run but while debugging when i come to cmd.ExecuteQuery() it throws following error..
ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.77-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'abc()' at line 1.
So plz sort out the problem as soon as possible...
-
I have a button in my form and on click of that button I am writing this code....
OdbcCommand cmd ;
cmd = new OdbcCommand("abc", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();I have made a procedure named abc in database which is returning only one row from login table..So i am just checking that on click of that button my procedure should run but while debugging when i come to cmd.ExecuteQuery() it throws following error..
ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.77-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'abc()' at line 1.
So plz sort out the problem as soon as possible...
nitish_07 wrote:
So plz sort out the problem as soon as possible..
This is not the most polite way to ask for help. If you look carefully at the error message it gives clear details about where the problem lies, and what you need to do about it.
Programming is work, it isn't finger painting. Luc Pattyn
-
I have a button in my form and on click of that button I am writing this code....
OdbcCommand cmd ;
cmd = new OdbcCommand("abc", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();I have made a procedure named abc in database which is returning only one row from login table..So i am just checking that on click of that button my procedure should run but while debugging when i come to cmd.ExecuteQuery() it throws following error..
ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.77-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'abc()' at line 1.
So plz sort out the problem as soon as possible...
Your procedure returns a row of data, but you use a method that doesn't return anything with
ExecuteNonQuery
. Do you see the problem yet?*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Your procedure returns a row of data, but you use a method that doesn't return anything with
ExecuteNonQuery
. Do you see the problem yet?*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Well, it's not, obviously. The says that there's something wrong with your SQL SELECT statement, which we can't see. Sooooo.... where do you think you should be looking?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
I have a button in my form and on click of that button I am writing this code....
OdbcCommand cmd ;
cmd = new OdbcCommand("abc", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();I have made a procedure named abc in database which is returning only one row from login table..So i am just checking that on click of that button my procedure should run but while debugging when i come to cmd.ExecuteQuery() it throws following error..
ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.77-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'abc()' at line 1.
So plz sort out the problem as soon as possible...
-
ExecuteNonQurey should only be used for inserts, updates and deletes, if your preforming a select you should be saying ExecuteReader to return what ever you want, hope this helps, need any more help just ask.
OdbcCommand cmd;
cmd = new OdbcCommand("abc", cn);
cmd.CommandType = CommandType.StoredProcedure;
OdbcDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
string s = dr.GetString(0);
}after doing this I am getting the same error after line cmd.commandtype=cmd.executereader... now what should i do..it says odbcexception was unhandled..
-
OdbcCommand cmd;
cmd = new OdbcCommand("abc", cn);
cmd.CommandType = CommandType.StoredProcedure;
OdbcDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
string s = dr.GetString(0);
}after doing this I am getting the same error after line cmd.commandtype=cmd.executereader... now what should i do..it says odbcexception was unhandled..
Like I said yesterday, the exception message is reasonably clear that there is a problem in your stored procedure
abc()
. If you cannot figure out what is wrong with it then post it here so an SQL expert can help. -
Like I said yesterday, the exception message is reasonably clear that there is a problem in your stored procedure
abc()
. If you cannot figure out what is wrong with it then post it here so an SQL expert can help. -
Sir there is no problem with my stored procedure..It is working fine in database..when i call through c# it throws error...
There's obviously some problem there. If you refuse to give us the full information we cannot help.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
There's obviously some problem there. If you refuse to give us the full information we cannot help.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
This is my procedure abc..
DELIMITER $$
DROP PROCEDURE IF EXISTS `userdb`.`abc`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `abc`()
BEGIN
select * from login;
END$$DELIMITER ;
-
I had seen that from original mysql query browser...but as u said i deleted that ' ' from procedure name and then tried but found the same error...
Sorry, but as I said that was an uneducated guess, but your error message is definitely complaining about that line. You could start a new thread in the MySQL[^] forum, to see if any expert sees the question. I would suggest you post your C# code and your stored procedure and the full exact text of the error message.
-
Sorry, but as I said that was an uneducated guess, but your error message is definitely complaining about that line. You could start a new thread in the MySQL[^] forum, to see if any expert sees the question. I would suggest you post your C# code and your stored procedure and the full exact text of the error message.
-
Well I don't think any of the MySQL experts are going to be looking here.
-
This is my procedure abc..
DELIMITER $$
DROP PROCEDURE IF EXISTS `userdb`.`abc`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `abc`()
BEGIN
select * from login;
END$$DELIMITER ;
You've explicitely changed the delimiter to $$, but terminated the select statement with a semicolon. Regards, Manfred
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
Me, 2012-05-24