Just write the blame problem when writing the user registration process

xiaoxiao2021-03-06  43

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 ();

}

}

转载请注明原文地址:https://www.9cbs.com/read-56300.html

New Post(0)