473,803 Members | 3,095 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Table in Access

Hello Group,
In my apps I fill DataSet from MSAcces (file db1.mdb)
oleDbDataAdapte r1.Fill(fromAcc essDS,"MyTable" )
MyTable heve 4 columns,
I change in dataGrid
(dataGrid.DataS ource=fromAcces sDS.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 8425
Hi Nicholas,
I use oleDbDataAdapte r1.Update(fromA ccesDS) and
oleDbDataAdapte r1.Update(fromA ccesDS.MyTable) and
oleDbDataAdapte r1.Update(fromA ccesDS.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_CSDTransiti on";
OleDbDataAdapte r refAdapter = new OleDbDataAdapte r(strSelectA, master);
OleDbCommandBui lder refCommand = new OleDbCommandBui lder(refAdapter );

// The OleDbCommandBui lder 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.Upda te(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 oleDbDataAdapte r1.Update(fromA ccesDS) and
oleDbDataAdapte r1.Update(fromA ccesDS.MyTable) and
oleDbDataAdapte r1.Update(fromA ccesDS.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
22949
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 Server database that we have. Question follows: The following SQL statement, used in VBScript,
16
3880
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 table, or perhaps bytes, being updated where the engine just decides, screw it, i'll just make a new one. surfed this group and google, but couldn't find anything. the context: we have some java folk who like to parametize/
1
2715
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 Access to update automatically so when an employee is hired, my access table reflects that new employee that was added to the Oracle DB. I should say I have read-only access to the Oracle Db. Would I have to run an update query or can this be...
2
535
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 trying to join two tables if certain conditions are met § TaxID in Table 1 must match TaxID in Table 2 § DRG in Table 1 must match DRG in Table 2 § BeginDate in Table 1 must match BeginDate in Table 2 § If all these criteria are met and...
5
3544
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 do the update the changed parentid in the child table fails to change. No error is given its just that the change is not written to the Database. When I step through the records for the child table the one I would expect to be changed has a row...
6
2691
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 person wants to receive a newsletter and 0 no, don't want to receive it. Now.....when trying to create an UPDATE statement I am running into problems writing the code for it. I had issues before with missing commas but now that the commas are there...
1
473
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 only disctinct records in it based field X. Table B also has a colume Y that I need to copy to table A's column Y. So basically I want all of column Y's data in Table B copied to table A's column Y.
11
1852
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; 1. Regenerated the data adapter sqls by running the data adapter wizard and pasting the resulting code into my app. 2. Deleted the data adapter correspond to the relevant access table from the
13
8895
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 transaction. Does anyone have an SQL statement I can throw at it that would accomplish this? If I can't figure out how to do it, I'm going to have to send two discreet SQL commands for each record which will take infinitely longer than a...
3
3969
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
9565
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10295
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9125
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2972
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.