Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am getting problem with brandonio's registration form...
#1
hello guys,

Following the tutorials of brandonio i made a registration form and tried to give some additional features to it.

Here the code of the registration form:
[code2=vbnet]Imports System.Windows.Forms
Imports MySql.Data.MySqlClient
Public Class registrationForm
Public conn As MySqlConnection
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
conn = New MySqlConnection(ServerString)

'/ Username existing verification
If tbx_username.Text = Nothing Or tbx_password.Text = Nothing Or tbx_conPassword.Text = Nothing Or tbx_email.Text = Nothing Or tbx_realname.Text = Nothing Then
MsgBox("Please fill up all the fields.", MsgBoxStyle.Information, "Error")
Else
Dim Username As Boolean = True
Dim Email As Boolean = True
conn.Open()
Dim sqlquery As String = "SELECT * FROM reg_members WHERE Username = '" & tbx_username.Text & "';"
Dim data As MySqlDataReader
Dim adapter As New MySqlDataAdapter
Dim command As New MySqlCommand
command.CommandText = sqlquery
command.Connection = conn
adapter.SelectCommand = command
data = command.ExecuteReader
While data.Read()
If data.HasRows() = True Then
MsgBox("Username is already in use!", MsgBoxStyle.Exclamation, "Error")
Username = False
data.Close()
Else
data.Close()
Username = True
End If
End While
data.Close()

'/ Email existing verification
Dim sqlquery2 As String = "SELECT * FROM reg_members WHERE Email = '" & tbx_email.Text & "';"
Dim data2 As MySqlDataReader
Dim adapter2 As New MySqlDataAdapter
Dim command2 As New MySqlCommand
command2.CommandText = sqlquery2
command2.Connection = conn
adapter2.SelectCommand = command2
data2 = command2.ExecuteReader
While data2.Read()
If data2.HasRows() = True Then
MsgBox("Email is already in use!", MsgBoxStyle.Exclamation, "Error")
Email = False
data2.Close()
Else
data2.Close()
Email = True
End If
End While
data2.Close()

'/ Data entry section
If Not tbx_conPassword.Text = tbx_password.Text Then
MsgBox("Password doesn't match!", MsgBoxStyle.Critical, "Error")
Else
If Username = True And Email = True Then
Dim sqlquery3 As String = "INSERT INTO reg_members (Username, Password, Email, FullName)VALUES ('" & tbx_username.Text & "','" & tbx_password.Text & "','" & tbx_email.Text & "','" & tbx_realname.Text & "')"
Dim data3 As MySqlDataReader
Dim adapter3 As New MySqlDataAdapter
Dim command3 As New MySqlCommand
command3.CommandText = sqlquery3
command3.Connection = conn
adapter3.SelectCommand = command3
data3 = command3.ExecuteReader
MsgBox("You have successfully registered! Now you can log in.", MsgBoxStyle.Information, "Registration Successful")
Me.Close()
loginForm.Show()
End If
End If
End If
End Sub

Private Sub tbx_conPassword_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbx_conPassword.TextChanged
If Not tbx_conPassword.Text = tbx_password.Text Then
Label8.Text = "Password doesn't match."
Else
Label8.Text = ""
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
tbx_username.Clear()
tbx_password.Clear()
tbx_conPassword.Clear()
tbx_email.Clear()
tbx_realname.Clear()
End Sub
End Class[/code2]

I have added the features to say email already exist as the login form already says that username already exist...but it works only for the username but not for the email address....after trying the code it gives an error of db conn close needed or open neeede or already opened such type of errors...

Please help me how can I solve this problem and what is the solved code.Please provide me the correction of this code...

Brandonio bro needs your help.....
Thanks in advance.......
#2
somebody please help me in this matter...

Brandonio bro where are u????


Possibly Related Threads…
Thread Author Replies Views Last Post
  i am getting a problem with brandonio's login form mnxford 1 8,295 03-27-2013, 10:55 AM
Last Post: mnxford
  How do I fill my form with MySQL data based on Combobox? kismetgerald 8 24,887 10-14-2012, 09:05 PM
Last Post: brandonio21
  getting a file name form a save dialoge zmanalpha 3 13,218 08-04-2012, 03:15 PM
Last Post: brandonio21
  Form/Application Store PsychicShadow 2 11,328 06-02-2011, 09:16 PM
Last Post: xolara
  Problem with Syntax Highlighting? brandonio21 2 12,013 04-02-2011, 10:37 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)