PC Review


Reply
Thread Tools Rate Thread

How to change rowstate of DataRow

 
 
ad
Guest
Posts: n/a
 
      4th Nov 2005
When we create a DataSet by Select command like:
//--------------------------------------------------------------------
SqlCommand myCommand = new SqlCommand("SELECT * FROM Suppliers",
myConnection);
myCommand.CommandType = CommandType.Text;

myAdapter.SelectCommand = myCommand;
ds = new DataSet("Customers");
myAdapter.Fill(ds);
//--------------------------------------------------------------------
The RowState of every rows in the dataset is Unchanged.
I want to change the RowState of every rows to Added.
How can I do that?

 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      4th Nov 2005
Hi,

One way would be to set
myAdapter.AcceptChangesDuringFill = false;

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"ad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When we create a DataSet by Select command like:
> //--------------------------------------------------------------------
> SqlCommand myCommand = new SqlCommand("SELECT * FROM Suppliers",
> myConnection);
> myCommand.CommandType = CommandType.Text;
>
> myAdapter.SelectCommand = myCommand;
> ds = new DataSet("Customers");
> myAdapter.Fill(ds);
> //--------------------------------------------------------------------
> The RowState of every rows in the dataset is Unchanged.
> I want to change the RowState of every rows to Added.
> How can I do that?
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataRow RowState Delete Techno_Dex Microsoft Dot NET Framework Forms 0 6th Oct 2006 04:44 PM
Change RowState property of DataRow osmarjunior Microsoft C# .NET 2 26th Apr 2006 01:55 PM
Changing DataRow Rowstate progamatically =?Utf-8?B?Q2h1Y2s=?= Microsoft ADO .NET 2 4th Mar 2004 06:17 PM
DataRow.RowState Don Circle Microsoft ADO .NET 4 26th Nov 2003 10:22 AM
Problem With DataRow Rowstate Marco Gatto Microsoft ADO .NET 4 28th Aug 2003 10:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:54 AM.