can we assign object value to the label?
- by user334294
I have a label for that i have to assign object value which is returned by stored procedure.my code as following
object returnvalue;
SqlConnection con = new SqlConnection("Data Source=vela21; Initial Catalog=MilkDb;Integrated Security=True");
con.Open();
string sa;
sa = textBox1.Text;
SqlCommand cmd = new SqlCommand("custname", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("Cid", SqlDbType.Int).Value = sa;
cmd.Parameters.Add("cname", SqlDbType.NVarChar, 20);
cmd.Parameters["cname"].Direction = ParameterDirection.Output;
returnvalue = cmd.ExecuteNonQuery();
label3.Text = Convert.ToString(returnvalue);
con.Close();
can anyone help me? plz........