473,472 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Update Table in Access

Hello Group,
In my apps I fill DataSet from MSAcces (file db1.mdb)
oleDbDataAdapter1.Fill(fromAccessDS,"MyTable")
MyTable heve 4 columns,
I change in dataGrid
(dataGrid.DataSource=fromAccessDS.Tables["MyTable"]) value in this
table.
My question:
How update Table in file db1.mdb), save my change in this table?

Thx
PawelR
Nov 15 '05 #1
2 8410
Hi Nicholas,
I use oleDbDataAdapter1.Update(fromAccesDS) and
oleDbDataAdapter1.Update(fromAccesDS.MyTable) and
oleDbDataAdapter1.Update(fromAccesDS.Tables["MyTable"])

and file db1.mdb is not changes.

Meybe I don't understend You. My English is very poor. Please write me
example lines.

Thx
Pawel
Nicholas Paldino [.NET/C# MVP] napisał:
Pawel,

If you still have the DataAdapter which you used to get the data, then
you can set the Update, Delete and Insert command properties to commands
that should be executed to update the rows in the table. You then call
Update, passing the dataset with the modified data to the method.

Hope this helps.


Nov 15 '05 #2
In this example, I'm using a connection object named 'master'.

string strSelectA = "SELECT * FROM REF_CSDTransition";
OleDbDataAdapter refAdapter = new OleDbDataAdapter(strSelectA, master);
OleDbCommandBuilder refCommand = new OleDbCommandBuilder(refAdapter);

// The OleDbCommandBuilder will automatically generate the Insert command
for the Update method...

try
{
refAdapter.Fill(ds1, "ref");
}
finally
{
master.Close();
}

// Change your dataset table "ref" here!

try
{
master.Open();
refAdapter.Update(ds1, "ref");
}
finally
{
master.Close();
ds1.Tables["ref"].Dispose();
}

Disposing the "ref" dataset table is not necessary, but I did in this
instance since I am no longer using it at this point.

Good Luck

- carl
"PawelR" <Pa************@poczta.onet.pl> wrote in message
news:bi**********@nemesis.news.tpi.pl...
Hi Nicholas,
I use oleDbDataAdapter1.Update(fromAccesDS) and
oleDbDataAdapter1.Update(fromAccesDS.MyTable) and
oleDbDataAdapter1.Update(fromAccesDS.Tables["MyTable"])

and file db1.mdb is not changes.

Meybe I don't understend You. My English is very poor. Please write me
example lines.

Thx
Pawel
Nicholas Paldino [.NET/C# MVP] napisał:
Pawel,

If you still have the DataAdapter which you used to get the data, then you can set the Update, Delete and Insert command properties to commands
that should be executed to update the rows in the table. You then call
Update, passing the dataset with the modified data to the method.

Hope this helps.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: jimserac | last post by:
I had previously posted this in an Access forum with negative results so will try here. Although this question specifies an Access database, I also wish to accomplish this with a large MS SQL...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
1
by: girlkordic | last post by:
I have a linked table from an Oracle database (that contains HR information for my company)in an Access database. The Oracle DB is updated on a daily basis. I would like one of my tables in...
2
by: NigelMThomas | last post by:
I have an especially challenging problem. I know there are a few geniuses in this group so perhaps; you can advise me whether or not this can be done as an update query in Access. Thanks. I am...
5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
6
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the ...
1
by: Nothing | last post by:
I have a field, Y, in table A that I need to update from table B, matching on comman field X in both tables. Table A has 10K+ records with field X in it (Field X multipul times). Table B has...
11
by: John | last post by:
Hi I had a working vs 2003 application with access backend. I added a couple fields in a table in access db and then to allow user to have access to these fields via app I did the following; ...
13
by: Terry Olsen | last post by:
I'm using OleDb to connect with an Access Database. I have anywhere from 10 to over 100 records that I need to either INSERT if the PK doesn't exist or UPDATE if the PK does exist, all in a single...
3
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.