Jump to content

Sistema de login


Recommended Posts

eu tou a tentar conecta a  base de dados que criei no phpmyadmin ao vb

pos o seguinte codigo no botao para registar novos users

Dim conn As MySqlConnection

        'connect to base de dados

        conn = New MySqlConnection()

        conn.connectionstring = "server= de utilizador=root;senha"



        Catch myerror As mysqlexception

            MsgBox("Erro ao conectar a Base de Dados")

        End Try

        'consulta SQL

        Dim myadapter As New mysqldataadapter

        Dim sqlquery = "select * from regester Where username = '" + Text + "'"

        Dim mycommand As New mysqlcommand

        mycommand.connection = conn

        mycommand.commandtext = sqlquery

        'Começa a Consulta

        myadapter.selectCommand = mycommand

        Dim mydata As mysqldatareader

        mydata = mycommand.executereader()

        ' Ve se o utilizador se ja existe

        If mydata.hasrows = 0 Then




            Dim registerfinal As New mysqldata

            Dim query = " Insert into register ( Nome de Utilizador, Senha,) Values ('" + Text + "','" + Text + "')"

            Dim command As New mysqlcommand()

            mycommand.connection = conn

            mycommand.commandtext = query

            'Começa a consulta

            myadapter.selectCommand = mycommand

            mydata = mycommand.executereader()


            MsgBox("username already in use.")

        End If

    End Sub

mas aparece varios erros


se alguem conseguir  como dar volta a isto ajudava me muito


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.