Hi,
You can create a function which checks for the value from data base
here is the sample code.
1:You will write a function
private Boolean usernameexists()
{
OleDbCommand com = new OleDbCommand("select Username from User_master where Username ='" + txt_username.Text + "'", con);
OleDbDataReader oledbrd1;
oledbrd1 = com.ExecuteReader();
if (oledbrd1.HasRows)
{
oledbrd1.Read();
unameerrmsg.Visible = true;
unameerrmsg.Text = "username already exist";
oledbrd1.Close();
return true;
}
else
{
unameerrmsg.Visible = false;
return false;
}
}
2: On your save button if username exist return
if (usernameexists() == true)
{
return;
}
You can also call this function on textbox textchanged()
hope this helps
Happy coding :)