0

hi,

plz help me how can i get the return value of mysql stored function from ASP.net with c#.
Currently i m using the following code for this purpose

string strConnect = "Data Source=" + host + ";Database=" + database + ";User ID=" + user + ";Password=" + password + ";Port=" + port;
        MySqlConnection conn = new MySqlConnection(strConnect);
        MySqlCommand cmd = new MySqlCommand("f_UserLogin", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add(new MySqlParameter("username", txt_user.Text));
        cmd.Parameters.Add( new MySqlParameter("pwd",txt_user.Text));
           try
            {
                cmd.Connection.Open();
                int res = cmd.ExecuteNonQuery();
                if (res > 0)
                {
                    txt_wronglogin.Text = "Success";
                }
                else
                {
                    txt_wronglogin.Text = "na pa g";
                }
            }                                
          catch (Exception ex)
          {
             txt_wronglogin.Text = ex.ToString();
          }

Thanks and Best Regards,
Nice Candy

Edited by __avd: Added [code] tags.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by nice_candy
0

Please suggest in what way u want to return the values

in the function definition i return 1 or 0 according to my condition. now how can i execute my function and get its result that will either 1 or 0.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.