please give me for this "when user creates new account ,when he enter his username ,it must check with database and if user already exits with same name,must give message that user exits".
Check if user exists
Collapse
X
-
Tags: None
-
-
Comment
-
What have you tried so far?Originally posted by KothuriKavithaplease give me for this "when user creates new account ,when he enter his username ,it must check with database and if user already exits with same name,must give message that user exits".
Do you know how to Use a database in your Application?
-FrinnyComment
-
try this:
SqlCommand sqlCount = myConnection.Cr eateCommand();
sqlCount.Comman dText = "SELECT COUNT(*) FROM tablename WHERE UserName = '" + aUserName + "'";
int recCount = (int)sqlCount.E xecuteScalar();
if (recCount == 0) // no existing record for username
{
insert record
}
else
{
user already exist
}Comment
Comment