ExecuteScalar And ExecuteReader Use In Checking Login Existence
In One Of My Previous Blog I'v Already tought you About
Execute Scaler Use To Count Rows
Now Here We Basicly Deal With ExecuteScalar And ExecuteReader Use In Checking Login Existence
1)Check On Create Login If Any One Already Existed:by ExecuteScalar
SqlCommand cmd=new .......
Object obj=cmd.ExecuteScalar();
if(Obj!=null)
{
//alert (user alerready Existed)
}
2)Check On Login If SomeOne Existed Or Not
SqlCommand cmd=new .......
SqlDataReader dr=cmd.ExecuteReader()
if(dr.HasRows)
{
dr.Read();
if(dr["Username"].ToString()==TextBox1.Text && dr["Password"].ToString()==TextBox2.Text )
{
//Welcome User
}
}
In One Of My Previous Blog I'v Already tought you About
Execute Scaler Use To Count Rows
Now Here We Basicly Deal With ExecuteScalar And ExecuteReader Use In Checking Login Existence
1)Check On Create Login If Any One Already Existed:by ExecuteScalar
SqlCommand cmd=new .......
Object obj=cmd.ExecuteScalar();
if(Obj!=null)
{
//alert (user alerready Existed)
}
2)Check On Login If SomeOne Existed Or Not
SqlCommand cmd=new .......
SqlDataReader dr=cmd.ExecuteReader()
if(dr.HasRows)
{
dr.Read();
if(dr["Username"].ToString()==TextBox1.Text && dr["Password"].ToString()==TextBox2.Text )
{
//Welcome User
}
}
thank vijay its help me alot!
ReplyDelete