473,378 Members | 1,333 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,378 software developers and data experts.

Update DataTable in DataSet

SMG
Hi there,
We have a DataSet with one datatable with three columns and multiple
rows. [Each rows has a unique key]

1st Column : Unique Key
2nd Column : Value to Change
3rd Column : Value to Change

Based on some conditions I want to update the values of the 2nd and 3rd
column but want to keep the dataset intact.
It should just change the values.

I tried with first filtering the dataset with select method, but returns an
array of rows which is separate than my dataset.

I want to use the same dataset with the changed values.
Regards,
Shailesh
Nov 18 '05 #1
2 5303

Hi SMG,

Try the following;

if you have an untyped dataset;
MyTable.Select("My Select Statement")[0]["MyColumn"] = MyValue;
if you have a typed dataset
lMyTable.FindByMyPrimaryColumn(MyColumnId).MyPrope rty = MyValue;

As far as I know, select statement does not return a copy, it returns a
reference to the row(s). So any change you make on these will affect the
dataset.

Hope this helps,

Ethem
"SMG" wrote:
Hi there,
We have a DataSet with one datatable with three columns and multiple
rows. [Each rows has a unique key]

1st Column : Unique Key
2nd Column : Value to Change
3rd Column : Value to Change

Based on some conditions I want to update the values of the 2nd and 3rd
column but want to keep the dataset intact.
It should just change the values.

I tried with first filtering the dataset with select method, but returns an
array of rows which is separate than my dataset.

I want to use the same dataset with the changed values.
Regards,
Shailesh

Nov 18 '05 #2
SMG
Hi Ethem,
Thanks, that works

Shailesh
"Ethem Azun" <Et*******@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...

Hi SMG,

Try the following;

if you have an untyped dataset;
MyTable.Select("My Select Statement")[0]["MyColumn"] = MyValue;
if you have a typed dataset
lMyTable.FindByMyPrimaryColumn(MyColumnId).MyPrope rty = MyValue;

As far as I know, select statement does not return a copy, it returns a
reference to the row(s). So any change you make on these will affect the
dataset.

Hope this helps,

Ethem
"SMG" wrote:
Hi there,
We have a DataSet with one datatable with three columns and multiple
rows. [Each rows has a unique key]

1st Column : Unique Key
2nd Column : Value to Change
3rd Column : Value to Change

Based on some conditions I want to update the values of the 2nd and 3rd
column but want to keep the dataset intact.
It should just change the values.

I tried with first filtering the dataset with select method, but returns an array of rows which is separate than my dataset.

I want to use the same dataset with the changed values.
Regards,
Shailesh

Nov 18 '05 #3

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

Similar topics

2
by: Chris | last post by:
I'm using a DataTable in my application. I am able to load rows into the DataTable quickly. What's puzzling me, however, is that when I update a set of cells in the DataTable, the update is really...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
8
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. ...
1
by: Joaquin | last post by:
OK, I hate myself for asking this, it's the worst question I have ever asked but it's worse not to ask: ¿How do I update a datatable in vs 2005? I mean, I am using a typed dataset, a...
3
by: RSH | last post by:
Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment. Both servers contain the same databases...
4
by: George | last post by:
Hi all, I am having trouble with updating my data in an Access database. here is my code: Imports System.Data.OleDb Dim AppPath As String = Mid(Application.ExecutablePath, 1,...
15
by: Scotty | last post by:
I like to have a good insert, update and delete code The code below sometimes workl ok sometimes doesnt work, what i am doing wrong?? Sub SaveAny() Dim command_builder As New...
2
by: Scotty | last post by:
I get stuck to write an update, insert and delete command, i am looking for some help to start Whats the best way to update 2 tables toe the database (Access) below my code used to load my...
2
by: BobLewiston | last post by:
Some of you may have seen my earlier thread “PasswordHash NULL problem”. I’ve started a new thread because investigation has shown that the problem is actually quite different than I previously...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.