hindi nyo po naiprepare yung command. Try nyo po lagyan ng command.Prepare() bago mag add ng parameter
pwede rin ito gamitin mo sa pag prepare para di gaano mahaba command.Parameters.AddWithValue("@paramname",value)
hindi nyo po naiprepare yung command. Try nyo po lagyan ng command.Prepare() bago mag add ng parameter
pwede rin ito gamitin mo sa pag prepare para di gaano mahaba command.Parameters.AddWithValue("@paramname",value)
try mo gumamit ng DataReader instead of DataTable para mas madali
public conn as new mysqlConnection("Server; User ID; Password; Database;")
dim str as string
str = "select * from useracct WHERE username = '" & txtUname.Text & "' and password = '" & txtPassword.Text & "'"
conn.Open()
Dim mysC As New MySqlCommand(str, conn)
Dim mysDR As MySqlDataReader
mysDR = mysC.ExecuteReader
If mysDR.HasRows Then
conn.Close()
MessageBox.Show("Welcome to MY PROGRAM!", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information)
frmMain.Show()
Me.Hide()
Else
MessageBox.Show("Username and Password did not match!", "Unable to login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
conn.Close()
txtPassword.Clear()
txtUname.Clear()
txtUname.Focus()
try mo gumamit ng DataReader instead of DataTable para mas madali
public conn as new mysqlConnection("Server; User ID; Password; Database;")
dim str as string
str = "select * from useracct WHERE username = '" & txtUname.Text & "' and password = '" & txtPassword.Text & "'"
conn.Open()
Dim mysC As New MySqlCommand(str, conn)
Dim mysDR As MySqlDataReader
mysDR = mysC.ExecuteReader
If mysDR.HasRows Then
conn.Close()
MessageBox.Show("Welcome to MY PROGRAM!", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information)
frmMain.Show()
Me.Hide()
Else
MessageBox.Show("Username and Password did not match!", "Unable to login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
conn.Close()
txtPassword.Clear()
txtUname.Clear()
txtUname.Focus()