Jump to content

Sistema de login


rjsma
 Share

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=192.168.10.22:nome de utilizador=root;senha"

        Try

            conn.open()

        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

            MsgBox("Registado")

            conn.close()

            conn.open()

            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()

        Else

            MsgBox("username already in use.")

        End If

    End Sub

mas aparece varios erros

http://bayimg.com/pAeegAaCE

se alguem conseguir  como dar volta a isto ajudava me muito

cumps

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
 Share

×
×
  • 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.