HI,
From stored procedure you have only one select statement which is returning. So, It returns Table count 1.
Try this.
cmd.CommandText = "SP_user_verifi";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Name", nameforlogin.Text);
cmd.Parameters.AddWithValue("@Password", pwdforlogin.Text);
SqlDataAdapter da = new SqlDataAdapter();
DataTable dt = new DataTable();
da.SelectCommand = cmd;
da.Fill(dt);
if (dt!= null && dt.Rows.Count > 0)
{
Session["Id"] = dt.Rows[0]["id"].ToString();
}
or
cmd.CommandText = "SP_user_verifi";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Name", nameforlogin.Text);
cmd.Parameters.AddWithValue("@Password", pwdforlogin.Text);
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataTable();
da.SelectCommand = cmd;
da.Fill(ds);
if (ds!= null && ds.Tables.Count > 0)
{
Session["Id"] = ds.Tables[0].Rows[0]["id"].ToString();
}
Hope it helps you.
Thanks.