Public Class Form1
Inherits System.Windows.Forms.Form
Dim con As New OleDb.OleDbConnection
Dim dbprovider As String
Dim dbsource As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim run = New OleDb.OleDbCommand
Dim sql As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dbprovider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
dbsource = "Data Source = C:\Documents and Settings\aditya\My Documents\project.mdb"
con.ConnectionString = dbprovider & dbsource
con.Open()
sql = "INSERT INTO user values('1','aditya','goel')"
da = New OleDb.OleDbDataAdapter(sql, con)
run = New OleDb.OleDbCommand(sql, con)
run.ExecuteNonQuery()
ABOVE CODE GIVES THE FOLLOWING ERROR WHEN I RUN IT.....:-
"An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an invocation."