mrneilbarton
asked on
ASP.NET C# Get Value From Stored Procedure Example - Slightly Urgent
Hi,
Need a quick example of a stored procedure in C#, normally programme in VB so getting slightly annoyed with this at the moment as nothing i do seems to work.
The code i have so far is below, i just need the SQL reader bit in c# and grab the column memberCounter and store it in a variable, an full example would be great.
Need a quick example of a stored procedure in C#, normally programme in VB so getting slightly annoyed with this at the moment as nothing i do seems to work.
The code i have so far is below, i just need the SQL reader bit in c# and grab the column memberCounter and store it in a variable, an full example would be great.
sqlConnection conn = new SqlConnection();
SqlCommand cmd = new SqlCommand();
conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connstring"].ConnectionString;
conn.Open();
string SQLStr = "bart_CheckEmail";
cmd.CommandText = SQLStr;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 60;
cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = fldEmailSignUp.Text;
cmd.Connection = conn;
*THIS IS WHERE I WANT TO READ THE COLUMN memberCounter and store it in a varable*
conn.Close();
ASKER
i dont understand how that can retreive the column memberCount with vb you can do rs("memberCount") - nice and simple - what is the same for c#
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
perfect that is what i was looking for, now i know where i am
something like
Int64 myCoutner = Convert.ToInt64( cmd.ExecuteScalar().ToStri