hello
i have build a database using MS ACCESS and write a coding in VB.NET to connect it as below
but when i click on the saveB button, the error below show up
and this error points to the code below
may i know what i did wrong?
i follow the instruction that was given by this thread
http://www.computerhelp.forum/showthread.php?t=69746
but i still getting the same error
can please help?
thank you in advance
i have build a database using MS ACCESS and write a coding in VB.NET to connect it as below
Code:
Imports System.Data.OleDb
Public Class addItem
Inherits System.Windows.Forms.Form
Dim myconnection As New OleDbConnection("provider=microsoft.jet.oledb.4.0; datasource = Application.ExecutablePath + \LibrarySystem.mdb")
Private Sub saveB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles saveB.Click
myconnection.Open()
Dim mycom As New OleDbCommand("INSERT INTO Product(product_code) VALUES (" & productTb.Text & ")", myconnection)
Dim MyReader As OleDbDataReader = mycom.ExecuteReader()
mycom.ExecuteNonQuery()
myconnection.Close()
MyReader.Close()
mycom.Dispose()
End Sub
but when i click on the saveB button, the error below show up
An unhandled exception of type System.Data.OleDb.OleDbException occurred in system.data.dll
and this error points to the code below
Code:
myconnection.Open()
may i know what i did wrong?
i follow the instruction that was given by this thread
http://www.computerhelp.forum/showthread.php?t=69746
but i still getting the same error
can please help?
thank you in advance