Y
YarpMeister21
Guest
As stated in title the provider Microsoft.ACE.OLEDB.12.0 is not registered on the local machine and thus is causing some issues. Here is the code I am currently using, and the access format is in 2002-2003 on Visual Studio 2013 using Visual Basic language.
connection.Close()
provider = "Microsoft.ACE.OLEDB.12.0;Data Source=H:\Database_File_for_my_Database.accdb"
connString = provider + dataFile
connection.connectionstring = connString
connection.Open()
Dim str As String
str = "Insert into Items([Title],[Author],[Price],[Reference Number]) Values (?,?,?,?)"
Dim cmd As OleDbCommand = New OleDbCommand(str, connection)
cmd.Parameters.Add(New OleDbParameter("Title", CType(txtTitle.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Author", CType(txtAuthor.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Price", CType(txtPrice.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Reference Number", CType(txtRefNo.Text, String)))
Try
cmd.ExecuteNonQuery()
cmd.Dispose()
connection.close()
txtTitle.Clear()
txtAuthor.Clear()
txtPrice.Clear()
txtRefNo.Clear()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Any help would be greatly appreciated.
Continue reading...
connection.Close()
provider = "Microsoft.ACE.OLEDB.12.0;Data Source=H:\Database_File_for_my_Database.accdb"
connString = provider + dataFile
connection.connectionstring = connString
connection.Open()
Dim str As String
str = "Insert into Items([Title],[Author],[Price],[Reference Number]) Values (?,?,?,?)"
Dim cmd As OleDbCommand = New OleDbCommand(str, connection)
cmd.Parameters.Add(New OleDbParameter("Title", CType(txtTitle.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Author", CType(txtAuthor.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Price", CType(txtPrice.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Reference Number", CType(txtRefNo.Text, String)))
Try
cmd.ExecuteNonQuery()
cmd.Dispose()
connection.close()
txtTitle.Clear()
txtAuthor.Clear()
txtPrice.Clear()
txtRefNo.Clear()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Any help would be greatly appreciated.
Continue reading...