Click here to Skip to main content
15,940,550 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello all, need help how to login to database wamp after i doing all mysql connection
VB
Imports System
Imports System.Data
Imports MySql.Data.MySqlClient
Public Class Form1
    Dim con As MySqlConnection = New MySqlConnection("Server=localhost;Database=newdb;Uid=root;Pwd=;")
    

    Private Sub cmdenter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdenter.Click
        Dim sqlquery = "select * from user"
        Dim command As New MySqlCommand
        command.Connection = con
        command.CommandText = sqlquery
        Dim data As New MySqlDataAdapter



        Dim ds As DataSet = New DataSet()
        Dim dataAdapter1 As MySqlDataAdapter = New MySqlDataAdapter
        Try
            con.Open()
            MessageBox.Show("Connection Opened Successfully")
            con.Close()
        Catch myerror As MySqlException
            MessageBox.Show("Error Connecting to Database: " & myerror.Message)
        Finally
            con.Dispose()
        End Try


        If TextBox1.Text = sqlquery And TextBox2.Text = sqlquery Then

            Form7.Show() 'Shows the Login Success Form
            Form2.Show()
            Me.Hide()       'Hides the Login Screen

        Else

            'A Message box that displays you have entered the wrong username and password

            MsgBox("You have entered the wrong username and password", MsgBoxStyle.Information, "login error")
        End If
      

    End Sub
Posted
Updated 14-Nov-11 19:34pm
v3

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900