Question problem in stored procedure

Status
Not open for further replies.

nitish_07

Member
Joined
Feb 14, 2012
Messages
7
Programming Experience
Beginner
Hi..I am developing a project
(c#.net) called mysql querybrowser..There is problem with stored procedure. Actually user will create and run stored procedure at run time...so 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 it...so 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");

conn.Open();
cmd.ExecuteNonQuery()
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..
 
actually ii know it..but the problem is i m unable to register in to C# forum because captcha image is not showing..thats why i posted it here...
 
actually ii know it..but the problem is i m unable to register in to C# forum because captcha image is not showing..thats why i posted it here...
Try the C# forum again, or later. I notified the admin.
 
Status
Not open for further replies.
Back
Top