title: codes for Login using Vb.net and Mysql as database
body: <p>please help to debug my codes. it is a login form , it cant run because of some errors in codes. please help me.. i dont know how to debug it.<br>
  i am a beginner in programming. </p>
  
  <pre class="lang-vb prettyprint-override"><code>Imports MySql.Data.MySqlClient
  
  Public Class Form1
  
       ' Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          Dim cmd As New MySqlCommand
          Dim da As New MySqlDataAdapter
          Dim con As MySqlConnection = jokenconn()
      End Sub'
  
      Public Function jokenconn() As MySqlConnection
          Return New MySqlConnection("server=localhost;user id=root;Database=db_ko;")
      End Function
  
      Private Sub cmdlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdlogin.Click
          Dim connString As String = "Database=db_ko;Data Source=localhost;User ID=root;"
  
          Dim conn As New MySqlConnection(connString)
          Dim cmd As New MySqlCommand
  
          Dim user As String = txtusername.Text
          Dim pass As String = txtpass.Text
          Dim reader As DataTableReader
  
          conn.Open()
          cmd.CommandText = "SELECT * FROM `db_account` WHERE username= '" &amp; txtusername.Text &amp; "' and password= '" &amp; txtpass.Text &amp; "', conn"
          cmd.Connection = conn
  
          cmd.Parameters.Add(New MySqlParameter("?UserName", txtusername.Text))
          cmd.Parameters.Add(New MySqlParameter("?Password", txtpass.Text))
  
          cmd.Connection = conn
          'cmd.EndExecuteReader = reader
  
          If reader.HasRows() Then
              MessageBox.Show("Login success!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information)
              Form2.Show()
              Me.Close()
  
          Else
  
              MsgBox("Invalid Login information.!", MessageBoxButtons.OK, MessageBoxIcon.Information)
          End If
          conn.Close()
  
      End Sub
  
  End Class
  </code></pre>
  
  <p>sorry for the codes are wrong. thank you advance!!</p>