Unlike others who critize I look to help.
Casey, the following code executes a stored procedure on sql server and
returns a single value. Let me know if you need anything else:
SqlConnection conn = new SqlConnection(strConn);
SqlCommand cmd = new SqlCommand("UserRole", conn);
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
cmd.Parameters.Add(new
SqlParameter("@value",SqlDbType.NVarChar,10,Parame terDirection.ReturnValue,
false,0,0,"Value",DataRowVersion.Default, null));
cmd.UpdatedRowSource = UpdateRowSource.OutputParameters;
cmd.Parameters.Add("@username", SqlDbType.NVarChar, 20).Value =
UserName.Text;
cmd.Parameters.Add("@password", SqlDbType.NVarChar, 20).Value =
Password.Text;
cmd.ExecuteNonQuery();
string value = cmd.Parameters["@value"].Value.ToString();
if (value == "1")
Label1.Text = "Admin";
if (value=="2")
Label1.Text = "User";
if (value=="3")
Label1.Text = "public";
conn.Close();
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:10**********************************@microsof t.com...
Or to try to find the answer to the problem on your own for that matter?
At any rate, I don't know for sure if the MSDN docs contain code samples
on this specific subject, but you if you look up the SqlCommand and
SqlParameter classes from the System.Data.SqlClient namespace, that should
get you started.
"Miha Markic [MVP C#]" wrote:
You didn't stretch too much to describe the problem in more details, did
you?
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
"Casey" <CL*****@synoptics.com> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl... Hi there - I need some help. I need to find some csharp sample code
that uses a stored procedure to return a single value.Any help is
appreciated.
thanks
Casey