|
I have a button in my form and on click of that button I am writing this code....
<pre>
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
|
|
|
|
|
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?
|
|
|
|
|
ya i know....but till that point code should run correctly....I am just checking...
|
|
|
|
|
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?
|
|
|
|
|
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..
|
|
|
|
|
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.
|
|
|
|
|
This is my procedure abc..
DELIMITER $$
DROP PROCEDURE IF EXISTS `userdb`.`abc`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `abc`()
BEGIN
select * from login;
END$$
DELIMITER ;
|
|
|
|
|
This is an uneducated guess, based on a quick scan of this page[^], but are you sure you need the quotes around the procedure name in your CREATE statement?
|
|
|
|
|
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.
|
|
|
|
|
Sir I had already posted all the things in my post....
|
|
|
|
|
Well I don't think any of the MySQL experts are going to be looking here.
|
|
|
|
|
You've explicitely changed the delimiter to $$, but terminated the select statement with a semicolon.
Regards,
Manfred
|
|
|
|
|
Hi,
Is there or will there be a LightSwitch forum for specific issues regarding development in MS LightSwitch?
I looked around but didn't find such
Albert
|
|
|
|
|
I'd either ask in the WPF/Silverlight forum or in the Q and A forums if I were you.
|
|
|
|
|
I need an example how to design WCF service where I could call sp from SQL to update data
|
|
|
|
|
Calling a stored procedure is exactly the same no matter what type of app you're making, so you can use any of the MILLIONS of tutorials and articles out there to do that.
|
|
|
|
|
fully concur with the previous poster - one thing got nothing to do with the other. You call sp in .net the same way regardless of the type of application you are using. Are there's ton of information in the internet on how to do just that.
|
|
|
|
|
I have a client application that connects to a server using sockets. The API published by the company that runs the server states '.. communication is done using SSL-encrypted TCP sockets.'
After connecting, I get a connection success. On sending a message, the server reports a 'SSL Handshake failed' error.
How do i establish a SSL Handshake? Are there any code snippets available? I am using the Socket Class and not the TCPClient Class to establish connection. Any help in this matter will be highly appreciated.
|
|
|
|
|
This[^] seems to suggest you start by setting the request's EnableSsl property to true.
|
|
|
|
|
Hi,
I've managed to create a pie chart, and play with it a little bit, but one thing I am not able to do is add percentages to the different pieces of the pie.
I've created a pietable from which I build my chart, which has two columns, first column "stockname", second column "stockvalue".
I couldn't get the percentages to show up, so I decided to add a third column "percentage" and calculate it there, but then I struggle to show that one in the label.
The end result should be that every slice of the pie should show the stockname and the percentage.
How to write this in code?
Thanks
|
|
|
|