The following code I entered the username who has not been registered.
Display.text = "This support already exists";
But at the same time, the new username added to the database, that is, the code in IF and ELSE is executed at the same time, it is really strange.
// User Registration
Public void login_click (Object Sender, System.EventArgs E)
{
// Verify
IF (page.issalid)
{
String strconnt = "provider = microsoft.jet.Oledb.4.0; data source =" server.mappath ("db / sample.mdb");
OLEDBConnection myconn = new oledbconnection (strConNT);
// Open connection
Myconn.open ();
String strsql;
Strsql = "Select * from zhuce where username = '" name.text "'";
OLEDBCommand mycommand = new oledbcommand (strsql, myconn);
OLEDBDataReader Reader = MyCommand.executeReader ();
IF (Reader.Read ())
{
Reader.Close ();
Display.text = "This support already exists";
}
Else
{
Reader.Close ();
Strsql = "Insert INTO Zhuce VALUES ('" name.text ",'" password.text ", '" email.text "";
MyCommand = New OLEDBCommand (strsql, myconn);
mycommand.executenonquery ();
Display.text = "Successful registration";
}
MyConn.close ();
}
}