473,403 Members | 2,366 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,403 software developers and data experts.

Dataset Object updating

Is there a way to update a DataSet Object?

I have a Dataset Object (DataSetObj.Tables(0) - one table) that I read in
from a .csv file.

I normally do the following to get my data from the .csv:

DataSet DataSetObj As New DataSet;
DataTable DTDepartment As New DataTable;
DataTable dt As New DataTable;

OleDbDataAdapter da As New OleDb.OleDbDataAdapter("Select * from " +
"temp.csv", conn);
da.Fill(DataSetObj);

I can get some rows by doing the following:

drCollection = DataSetObj.Tables[1].Select("F1 = 'FRANK'");

Is there a way to Update the tables inside the Dataset?

For example: I would like to change the all the values in Column 1 to 1084
if Column 4 = 'Retirement' and change all the values to 5300 if Column 4 =
'Medicare Employer' etc.

I would then read the file and output it to another .csv file.

Thanks,

Tom

Mar 27 '07 #1
1 1180
You can certainly update, delete or insert rows in any table of a DataSet,
and then use its WriteXml method (or some other techique) to persist the
revised data to a file.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"tshad" wrote:
Is there a way to update a DataSet Object?

I have a Dataset Object (DataSetObj.Tables(0) - one table) that I read in
from a .csv file.

I normally do the following to get my data from the .csv:

DataSet DataSetObj As New DataSet;
DataTable DTDepartment As New DataTable;
DataTable dt As New DataTable;

OleDbDataAdapter da As New OleDb.OleDbDataAdapter("Select * from " +
"temp.csv", conn);
da.Fill(DataSetObj);

I can get some rows by doing the following:

drCollection = DataSetObj.Tables[1].Select("F1 = 'FRANK'");

Is there a way to Update the tables inside the Dataset?

For example: I would like to change the all the values in Column 1 to 1084
if Column 4 = 'Retirement' and change all the values to 5300 if Column 4 =
'Medicare Employer' etc.

I would then read the file and output it to another .csv file.

Thanks,

Tom

Mar 28 '07 #2

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

Similar topics

6
by: Vik | last post by:
A dataset is saved in session state. Then the dataset is filled out with the new records using a dataadapter. It appears then that the dataset saved in session state contains the new records even...
0
by: Vijay Balki | last post by:
I am fetching data in DataSet - myDataSet, from a remote database using a Web Service in my VB.NET client..Once I fetch it I store the data in XML file (myXMLFile) using the WriteXML method of the...
4
by: Dave Taylor | last post by:
I've been using the dataset designer in Visual Studio to create typed datasets for my application by dragging over tables from the Server Explorer and dropping them into the designer. The problem...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
1
by: batista | last post by:
Hello all, I have a third praty grid control...named C1grid. Im using it in one of my apps.. Now, I have bind this grid to a custom dataset class named "DataViewEx". The code of the class is...
0
by: Johnny | last post by:
I have a PocketPC mobile application that gets its data from the Sql Server database via a web service. The web service returns a dataset that I need to load into the SqlCe database on the mobile...
2
by: Carl Heller | last post by:
Working in VS2003, .Net 1.1 I'm working on a project where I compare data between two databases. This is a lengthy process, and very data intensive, so I decided to create a class, and thread...
2
by: Sheikko | last post by:
ADO.NET - Working with DataSet ========================= HI, I want to create an application that interact with a DB. I wont to use SQL statement, but I want to use DataSet. - I have created my...
1
by: Neil Chambers | last post by:
This is more likely a question for an SQL group but as I'm using powershell and dotnet it may be relevant Overview: I'm trying to pull data from Excel into a DataSet - modifying the DataSet -...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...
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
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...

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.