ExecuteReader
SqlConnection cn=new SqlConnection(ConfigurationManager.AppSettings["CS_localsource"]); SqlCommand cmd = new SqlCommand("validatelogin",cn); cmd.CommandType = CommandType.StoredProcedure; SqlParameter param1 =new SqlParameter("@usename",SqlDbType.VarChar,300); param1.Direction=ParameterDirection.Input; param1.Value=textBox1.Text; SqlParameter param2=new SqlParameter("@password",SqlDbType.VarChar,300); param2.Direction=ParameterDirection.Input; param2.Value=textBox2.Text; SqlParameter param3=new SqlParameter("@formname",SqlDbType.VarChar,500); param3.Direction=ParameterDirection.Output; cmd.Parameters.Add(param1); cmd.Parameters.Add(param2); cmd.Parameters.Add(param3); cn.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { MessageBox.Show("Test"+param3.Value); } else { label3.Enabled = true; label3.Text = "Invalid Username and Password"; label3.BackColor = Color.Red; } cn.Close(); }
while (dr.Read()) { MessageBox.Show("Test"+param3.Value); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)