04-06-2012, 03:49 AM 
		
	
	
		If you are trying to make something similar to a register you can try out the code i use
You shouldnt need to use a While Data.Read() in the code
	
	
Code:
Private Sub MySqlRegister(ByVal username As String, ByVal password As String)
        Try
            MySqlConnection = New MySqlConnection
            MySqlConnection.ConnectionString = "server=" & Host & ";Port=" & Port & ";User id=" & User & ";Password=" & Pass & ";database=" & Database
            MySqlConnection.Open()
            Dim MySqlAdapter As New MySqlDataAdapter
            Dim SqlQuery = "SELECT * FROM testing WHERE username='" & username & "'"
            Dim Command As New MySqlCommand
            Dim MyData As MySqlDataReader
            Dim RegisterFinal As New MySqlDataAdapter
            Command.Connection = MySqlConnection
            Command.CommandText = SqlQuery
            MySqlAdapter.SelectCommand = Command
            MyData = Command.ExecuteReader
            If MyData.HasRows = 0 Then
                MySqlConnection.Close()
                MySqlConnection.Open()
                SqlQuery = "INSERT INTO testing (username, password) VALUE('" & username & "','" & password & "')"
                Command.Connection = MySqlConnection
                Command.CommandText = SqlQuery
                RegisterFinal.SelectCommand = Command
                MyData = Command.ExecuteReader
                ''send register success notice
                Send("responseR||Registered!||", Server.clientSocket)
                Log(username & " has been registered!", txt_log)
                MySqlConnection.Close()
                MyData.Close()
            Else
                ''send failed notice
                Send("responseR||There was an error in registration||", Server.clientSocket)
                Log(username & " Username is allready in use!", txt_log)
                MySqlConnection.Close()
                MyData.Close()
            End If
            MySqlConnection.Close()
            MyData.Close()
        Catch ex As Exception
            Log(ex.Message, txt_log)
        End Try
    End SubYou shouldnt need to use a While Data.Read() in the code
Website: <!-- m --><a class="postlink" href="http://www.PBAProductions.com">http://www.PBAProductions.com</a><!-- m -->
E-Mail: <!-- e --><a href="mailto atrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->
atrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->
Skype: Qwaxer
Youtube: Qwaxer
![[Image: 2hnx8av.jpg]](http://i54.tinypic.com/2hnx8av.jpg) 
	
	
E-Mail: <!-- e --><a href="mailto
 atrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->
atrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->Skype: Qwaxer
Youtube: Qwaxer
![[Image: 2hnx8av.jpg]](http://i54.tinypic.com/2hnx8av.jpg) 

 
 

 
