Home All Groups Group Topic Archive Search About

How to change rowstate of DataRow

Author
4 Nov 2005 6:17 AM
ad
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?

Author
4 Nov 2005 7:31 AM
Miha Markic [MVP C#]
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/

Show quote
"ad" <a*@wfes.tcc.edu.tw> wrote in message
news:1131085024.919515.71840@g47g2000cwa.googlegroups.com...
> 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?
>

AddThis Social Bookmark Button