MyCode is :
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
con.Open();
query = "EmpLogin";
SqlCommand cmd = new SqlCommand(query,con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@UserName", txtUserName.Text.ToString());
cmd.Parameters.AddWithValue("@Password", txtPassword.Text.ToString());
int usercount = (Int32)cmd.ExecuteScalar();
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Krishna GaradRank #191 · 12.8K reputationPosted Jan 14, 2013, 7:58 PM EST
cmd.CommandType = CommandType.StoreProcedure;
Deepali Patil137 reputationPosted Jan 14, 2013, 8:36 PM EST
It works.