aning diaz

aning diaz

  • NA
  • 1
  • 1.2k

login and update sql database using vb.net

Jul 15 2013 8:19 PM
 Dim conn As MySqlConnection
        conn = New MySqlConnection()
        conn.ConnectionString = "Server=localhost;User Id=root;Passsword=;Database=voting "


        Try
            conn.Open()

        Catch myerror As MySqlException
            MsgBox("error")

        End Try


        Dim myAdapter As New MySqlDataAdapter

        Dim myCommand As New MySqlCommand()
        myCommand.Connection = conn
        
        myAdapter.SelectCommand = myCommand
       
        If Textuser.Text = "" And Textpass.Text = "" Then
            MsgBox("invalid")
        ElseIf myCommand.CommandText = "SELECT * FROM tbl_elemvoters WHERE Username = '" + Textuser.Text + "' AND VoterID='" + Textpass.Text + "UPDATE Voted='" + "Yes"
                Form2.Show()
                Me.Hide()

Answers (2)