-4

REAL PROBLEM: I am making a admin control panel for my mysql database. I just learned the most of the stuff in vb.net i know everything now learning query language and i run into this question. I want that there would be a user validator(detector) what i mean is lets say someone is creating an account and the username exist it would show a messagebox that the username already exist and cancel creating the account.

Here is my code:

Imports MySql.Data.MySqlClient
Public Class Deathlairregnu
    Dim MySqlConn As MySqlConnection
    Dim MySqlCmd As MySqlCommand
    Private Sub ButtonNUS_Click(sender As Object, e As EventArgs) Handles ButtonNUS.Click
        MySqlConn = New MySqlConnection
        MySqlConn.ConnectionString =
            "server=localhost;userid=root;password=CONSORED;database=syscore"
        Dim MySqlRea As MySqlDataReader

        Try
            MySqlConn.Open()
            Dim Query As String
            Query = "insert into syscore.normaluser (nusername,nemail,npass,nphone,ncity) values ('" & TextBoxNUsern.Text & "','" & TextBoxNEmail.Text & "','" & TextBoxNPass.Text & "','" & TextBoxNPhone.Text & "','" & TextBoxNCity.Text & "')"
            MySqlCmd = New MySqlCommand(Query, MySqlConn)
            MySqlRea = MySqlCmd.ExecuteReader

            MessageBox.Show("Registration has been completed")
            MySqlConn.Close()
        Catch ex As MySqlException
            MessageBox.Show(ex.Message)
        Finally
            MySqlConn.Dispose()
        End Try
    End Sub
End Class

OPTIONAL: Ok. I have another question maybe you can solve at the same time. How could i add guid generator when the register submit button is pressed if you know what i mean? i have it in my website asp.net that i made myself. Would be very nice and helpful.

Big thanks for those who will try to help me. I will check this topic every 5 minutes.

1
  • My important question is the username validator the guid is optional. Commented Feb 2, 2015 at 15:28

2 Answers 2

0

Adding a uniqueidentifier column and adding the default to generate new guid

Downvotes probably because you didn't paste your code here, plus the fact that the question has been asked and answered many times. Did you search before asking?

Sign up to request clarification or add additional context in comments.

4 Comments

Yes i did search and i tried to paste the code here but it didin't work it was in wrong lines and messed up.
Ok. Do you know how to validate the username?
stackoverflow.com/questions/15189724/… that has also been asked and answered here.
I dont understand. I like when someone give me code example atleast to understand.
0

I did the important part. Optional is not needed for me but would've been good. Here: https://www.youtube.com/watch?v=ovoVfHW3Q8Y.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.