Modifying the column value in a dataset

Posted by Santhosh.Nallavelli under C# on 8/9/2012 | Points: 10 | Views : 898 | Status : [Member] | Replies : 1
I have a table in a dataset having some columns which is reading from the xml file, in which i want to update a column values in the following way.
1-mon
2-tue
3-wed
4-thu
5-fri
6-sat
7-sun

example data

columnA columnB columnC
dot net 1,2,3
articles forums 1,4,5,6
tech blogs 1,2,3,4,5,6,7

my output should e

columnA columnB columnC
dot net mon,tue,wed
articles forums mon,thu,fri,sat
tech blogs daily

please suggest me .




Responses

Posted by: Saratvaddilli on: 8/9/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
We can use the Data Adapter, Fill the Adapter with the Data Set and use Adapter.Update Method


SqlDataAdapter adapter = new SqlDataAdapter();
adapter.UpdateCommand = new SqlCommand(sql, connection);
SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
connection.Open();
DataSet days = new DataSet();
adapter.Fill(days);
adapter.Update(days);

http://msdn.microsoft.com/en-us/library/at8a576f.aspx

Thanks and Regards
V.SaratChand
Show difficulties that how difficult you are

Santhosh.Nallavelli, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response