473,320 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to update mdb file during run time

Can someone help me please. I can not figure out what is wrong. I get the error: "An unhandled exception of type 'System.Data.OleDb.OleDbException' occured in system.data.dll.

I am simply trying to update a field in a database by using the update command as follows:

Imports System.Data.OleDb

Dim myOleDbDataAdapter As OleDbDataAdapter
Dim myDataSet As DataSet = New DataSet
Dim myDataTable As DataTable = New DataTable
Dim myOleDbConnection As OleDbConnection
Dim myCommand As OleDbCommandBuilder
Dim artKeySave As Integer

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
myOleDbConnection = New _
OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0;" _
& "User ID=Admin;Data Source=C:\Test\test.mdb")
Try
myOleDbDataAdapter = _
New OleDbDataAdapter("select * from adminPassword", _
myOleDbConnection)

myOleDbDataAdapter.Fill(myDataTable)
lstAboutVBData.DataSource = myDataTable
lstAboutVBData.DisplayMember = "password"

Catch
Console.WriteLine("Error Opening {0}", _
myOleDbConnection.DataSource)
End Try
myCommand = New OleDbCommandBuilder(myOleDbDataAdapter)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

myOleDbDataAdapter.Fill(myDataSet, "adminPassword")
myDataTable = myDataSet.Tables("adminPassword")
Dim rowArticle As DataRow = myDataTable.NewRow()

rowArticle("password") = txtTitle
myDataTable.Rows.Add(rowArticle)

Dim newDataSet As DataSet
newDataSet = myDataSet.GetChanges()

'THE PROBLEM SEEMS TO BE HERE
myOleDbDataAdapter.Update(myDataSet, "adminPassword")
myDataSet.Tables("adminPassword").AcceptChanges()

End Sub
End Class
Aug 28 '06 #1
0 1347

Sign in to post your reply or Sign up for a free account.

Similar topics

198
by: Michael N. Christoff | last post by:
Java, the software developed by Sun Microsystems in the mid-1990s as a universal operating system for Internet applications, gave NASA a low-cost and easy-to-use option for running Spirit, the...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
2
by: MAS | last post by:
Below is a simple UPDATE that I have to perform on a table that has about 2.5 million rows (about 4 million in production) This query runs for an enourmous amount of time (over 1 hour). Both the...
5
by: rdraider | last post by:
Hi all, I'm looking for a way to re-number inventory items. The items exist in 50+ tables, hundreds of fields and there are several thousand items. Maybe one table could hold the list of old &...
7
by: Alex | last post by:
Hi all, I am trying to install a java stored procedure via the windows development centre. The linux box is running 8.1 FP4 as is the windoze platform. If I am on the linux box i can install...
5
by: hb | last post by:
Hi, In my ASP.Net application 'MyWebApp' , the mode="StateServer" in <sessionState> of Web.config file, and the ASP.NET State Service is set to start automatically on the server. But every...
1
by: Ruslan Shlain | last post by:
Not sure who to ask about this so, I have an app that grabs data from flat file and populates a dataset with it. Then using update method of a DataAdapter I insert all that data in to the SQL...
15
by: graham | last post by:
Hi all, <bitching and moaning section> I am asking for any help I can get here... I am at the end of my tether... I don;t consider myself a genius in any way whatsoever, but I do believe I have...
2
by: Dan Tallent | last post by:
When a user launches the program, I want it to test if an update is available. You see many examples of this method to update. (Quickbooks, Norton AntiVirus, online games) I have a method...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.