can we assign object value to the label?

Posted by user334294 on Stack Overflow See other posts from Stack Overflow or by user334294
Published on 2010-05-06T10:06:37Z Indexed on 2010/05/06 10:18 UTC
Read the original article Hit count: 172

Filed under:
|

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........

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET