I'm trying to connect to an access database using this coding:
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim str AsString
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\eoaoffice\eoa.mdb;")
cn.Open()
str = "insert into customer(cus_namess) values('" & names.Text & "')"
cmd = New OleDbCommand(Str, cn)
cmd.ExecuteScalar()
cn.Close()
When the code is ran this error shows:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll for the line that shows cmd.ExecuteScalar()...
please help me....thank you so much....
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim str AsString
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\eoaoffice\eoa.mdb;")
cn.Open()
str = "insert into customer(cus_namess) values('" & names.Text & "')"
cmd = New OleDbCommand(Str, cn)
cmd.ExecuteScalar()
cn.Close()
When the code is ran this error shows:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll for the line that shows cmd.ExecuteScalar()...
please help me....thank you so much....