Question problem in stored procedure


Mar 14, 2012
Programming Experience
Hi..I am developing a project
( called mysql querybrowser..There is problem with stored procedure. Actually user will create and run stored procedure at run in project creating is being done successfully but there is problem in calling stored procedure...because i have to pass the parameters at run time and if there is no parameter then no need to pass i am not getting that how to do it....Plz help me asap....thanks...

I am providing the code here so you can get a little bit idea of it...

string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
using (MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(connStr)) {
MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand();
cmd.Connection = conn;
cmd.CommandText = "CALL MyProcedure(@MyParam1, @MyParam2);";
cmd.Parameters.AddWithValue("@MyParam1", 123);
cmd.Parameters.AddWithValue("@MyParam2", "blah");

In cmd.commandText line how to add these myparam....because stored procedure is created run time....and also tell me the code in the case not providing any parameter..
You're trying to make this difficult when it's not. You already know what to do because you've already done it in your first post. All you have to do is what I told you to do in my first post. Make those changes and only those changes.
Top Bottom