My Insert statement is not working for some reason and I cannot figure out why. Any help would be highly appriciated.
Imports MySql.Data
Imports MySql.Data.MySqlClient
Public Class frmCreateUser
Dim connectionstring As String
Dim dbCon As MySqlConnection
Dim strQuery As String = ""
Dim SQLCmd As MySqlCommand
Dim DR As MySqlDataReader
Dim mysqladapter As MySqlDataAdapter
Dim c As New Class1
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try
'dbCon = New MySqlConnection("Server = localhost; Database=test;uid=root;Pwd=")
dbCon = New MySqlConnection("SERVER=localhost;DATABASE=test;")
If txtPwd.Text <> txtRetypePwd.Text Then c.StdMsg("Retype password is not matching.") : Exit Sub
If txtPwd.Text = "" Then c.StdMsg("Password required.") : Exit Sub
If txtUser.Text = "" Then c.StdMsg("Username required.") : Exit Sub
If ComboBox1.Text = "" Then c.StdMsg("Usertype required.") : Exit Sub
'Dim id As Integer = c.maxSelect("id", "logintest")
strQuery = "INSERT INTO login (username, password) values (" & txtUser.Text & "', '" & txtPwd.Text & "');"
'strQuery = "INSERT INTO logintest (id, username, password, type) VALUES (" & id & ", '" & txtUser.Text & "','" & txtPwd.Text & "','" & ComboBox1.Text & "');"
SQLCmd = New MySqlCommand(strQuery, dbCon)
dbCon.Open()
c.StdMsg("Record Saved.")
Me.Hide()
btnClear_Click(sender, e)
Catch ex As Exception
MsgBox("Failure to communicate!" & vbCrLf & vbCrLf & ex.Message)
End Try
dbCon.Close()
End Sub