Asp.net| User Registration////Verify that the user name is the same as the duplicate in the registration database!!!
Private Sub Check_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles check. Click
Dim MyConnection as OleDbConnection
Dim MyCommand as OleDbCommand
Dim dbname as String
dbname = Server.MapPath ("Db1.mdb")
MyConnection = New OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\documents and Settings\ Administrator\my documents\visual Studio projects\webapplication1 (2) \database\db1.mdb ") The directory where the database resides
If UserID. Text = "" Then
Label5.text = "error!! You must complete it "
Else
Dim Checklogin as String
Checklogin = "SELECT * from Users"
Dim cmd as New OleDbCommand (Checklogin, MyConnection)
Dim Reader as OleDbDataReader
If UserID. Text = Reader ("userid") Then
Label5.text = "The UserID had been used"
Else
Label5.text = "This userid can use"
End If
Catch Err as Exception
Trace.Write (Err. Message)
Label5.text = "Checked error"
Finally
If (not myconnection are nothing) Then
Myconnection.close ()
End If
End Try
End If
End Sub
User Registration
Private Sub Regist_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles regist. Click
Dim MyConnection as OleDbConnection
Dim MyCommand as OleDbCommand
Dim dbname as String
dbname = Server.MapPath ("Db1.mdb")
MyConnection = New OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\documents and Settings\ Administrator\my documents\visual Studio projects\webapplication1 (2) \database\db1.mdb ")
Dim Strinsert as String
Strinsert = "INSERT INTO Users ("
Strinsert &= "U_id,u_password)"
Strinsert &= "VALUES ('"
Strinsert &= userid. Text & "', '"
Strinsert &= password. Text & "')"
Dim cmd as New OleDbCommand (Strinsert, MyConnection)
Dim added as Integer
Try
Myconnection.open ()
Added = cmd. ExecuteNonQuery
If added > 0 Then
Label5.text = "Your information is added"
Response.Redirect ("Home.aspx")
End If
Catch Err as Exception
Trace.Write (Err. Message)
Label5.text = "added error"
Finally
If (not myconnection are nothing) Then
Myconnection.close ()
End If
End Try
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service