What's wrong in here, I always get some nasty errors even if the same code that I used earlier works. But when I apply it to other form it gives me the error above. here's my code:
Imports System.Data.OleDb
Public Class Updater2
Public adminID As String
Public adminName As String
Public adminPass As String
Private con As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db1.mdb;Jet OLEDB:Database Password=nrew123$%^;")
Private com As OleDb.OleDbCommand
Public Sub New()
con.Open()
com = New OleDb.OleDbCommand("Select * from admintable")
com.Connection = con
End Sub
Public Sub updates()
com.CommandText = "UPDATE admintable SET AdminName = '" & adminName & "', AdminPassS = '" & adminPass & "' WHERE ID = '" & adminID & "'"
com.ExecuteNonQuery()
End Sub
End Class
And here's the code in the button which tries to update the data:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
shikai.adminID = textbox1.text
shikai.adminName = TextBox4.Text
shikai.adminPass = TextBox3.Text
shikai.updates()
MsgBox("Successfully updated!")
End Sub
what might be wrong here?