Public Class Registration
Private Sub Register_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Register.Click
Dim StudentNum As String
Dim Password As String
Dim FirstName As String
Dim LastName As String
Dim YrandSec As String
StudentNum = Number.Text()
Password = Pass.Text
FirstName = Repass.Text
LastName = First.Text
YrandSec = Last.Text()
Dim Cmd As OleDb.OleDbCommand
Dim SQL As String
Dim objCmd As New OleDb.OleDbCommand
Dim Con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0 ;Data Source=C:\Users\SJMI.Alfie\Documents\Visual Studio 2010\Projects\WindowsApplication2\WindowsApplicati on1\Accounts.accdb")
SQL = "INSERT INTO Accounts VALUES ('" & StudentNum & "', '" & Password & "', '" & FirstName & "', '" & LastName & "', '" & YrandSec & "')"
Cmd = New OleDbCommand(SQL, Con)
Con.Open()
objCmd = New OleDbCommand(SQL, Con)
If Repass.Text = Pass.Text = True Then
If Number.Text = "" Or Pass.Text = "" Or Repass.Text = "" Or First.Text = "" Or Last.Text = "" Or YrSec.Text = "" Then
MsgBox("Please complete the field", MsgBoxStyle.Information, "Failed to create")
Else
objCmd.ExecuteNonQuery()
Con.Close()
Re.Text = ""
MsgBox("Account has been created", MsgBoxStyle.Information, "Congrats!")
For fade = 0.0 To 1.1 Step 0.2
Login.Opacity = fade
Login.Show()
Me.Hide()
Threading.Thread.Sleep(30)
Number.Text = ""
Pass.Text = ""
Repass.Text = ""
First.Text = ""
Last.Text = ""
YrSec.Text = ""
Next
End If
Else
Re.Text = "*Password didn't match!"
Number.Text = ""
Pass.Text = ""
Repass.Text = ""
End If
End Sub
Private Sub Cancel_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
For fade = 0.0 To 1.1 Step 0.2
Form1.Opacity = fade
Form1.Show()
Me.Close()
Threading.Thread.Sleep(30)
Next
End Sub
End Class
Mga master sa Vb.net pano ko po i bablock ung Duplicate entries sa vb.net ko. Primary key ko po dyan is Student Number. please help me.
via Symbianize Forum http://www.symbianize.com/showthread.php?t=1072597&goto=newpost
Aucun commentaire:
Enregistrer un commentaire