ckeck

Posted by Pokuri31 under ASP.NET on 9/20/2008 | Views : 1626 | Status : [Member] | Replies : 3
how to check user is already exist or not in c#




Responses

Posted by: Jayakumars on: 9/30/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

use this code

sqlcon.Open();
SqlDataAdapter sqladp = new SqlDataAdapter("SELECT * from userdetails WHERE username ='"+ txtusername.Text +"' and password ='"+ txtpassword.Text +"'", sqlcon);
sqladp.Fill(dt);
DataView dv = new DataView();
dv = dt.DefaultView;


if (dt.Rows.Count > 0)
{
//user exists
}
else { //use not exist}


Mark as Answer if its helpful to you

Pokuri31, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 9/30/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Please mark as answer if it helpful to you.

Mark as Answer if its helpful to you

Pokuri31, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Majith on: 9/21/2008 [Member] Starter

Up
0
Down
Hi,

To Check the existing user while you designing the DB you can set the Username field to Primary key.

you can validate your code to search the particaular user through
query.

Pokuri31, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response