HighTechTalks DotNet Forums  

Batch Insert/Updates

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Batch Insert/Updates in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Dimitris Milonas
 
Posts: n/a

Default Batch Insert/Updates - 11-28-2007 , 01:52 AM






Hello to all,

I would like to inserts/delete some records from a table and Update the
DataAdapter at the end of all the operations. The problem is that I would
like the intermediate changes to be visible in the User Interface (i.e.
DetailView). I am using the following code:

DataRow DataRow1 = DataSet1.Tables["Table1"].NewRow();

DataRow1["CODE"] = "...";
DataRow1["NAME"] = "...";

DataSet1.Tables["Table1"].Rows.Add(DataRow1);

At this point the new row is not visible to the User Interface. That means
that I have to Update the DataAdapter
(DataAdapter1.Update(DataSet1,"Table1")) in order for the new row to be
visible to User Interface. Is there a way the changes to be visible to the
User Interface before Update the DataAdapter?

Thanks in advance
Dimitris Milonas





Reply With Quote
  #2  
Old   
W.G. Ryan
 
Posts: n/a

Default Re: Batch Insert/Updates - 12-05-2007 , 01:50 PM






Manimpulating RowState will do it for you. When you call Update, it calls
AcceptChanges on each row as the row is updated. I'm not familiar with the
Details view but you could just call AcceptChanges on the row and it would
be in the same state is if you called Update.

The question is why it's showing. I suspect that once you call Update, the
SELECT query is firing again and that's why it's now visible. Do you hvae
the Refresh Dataset option on when you call Update?
"Dimitris Milonas" <gnout (AT) hotmail (DOT) com> wrote

Quote:
Hello to all,

I would like to inserts/delete some records from a table and Update the
DataAdapter at the end of all the operations. The problem is that I would
like the intermediate changes to be visible in the User Interface (i.e.
DetailView). I am using the following code:

DataRow DataRow1 = DataSet1.Tables["Table1"].NewRow();

DataRow1["CODE"] = "...";
DataRow1["NAME"] = "...";

DataSet1.Tables["Table1"].Rows.Add(DataRow1);

At this point the new row is not visible to the User Interface. That means
that I have to Update the DataAdapter
(DataAdapter1.Update(DataSet1,"Table1")) in order for the new row to be
visible to User Interface. Is there a way the changes to be visible to the
User Interface before Update the DataAdapter?

Thanks in advance
Dimitris Milonas







Reply With Quote
  #3  
Old   
Dimitris Milonas
 
Posts: n/a

Default Re: Batch Insert/Updates - 12-05-2007 , 03:48 PM



Hello and thank you for your answer.

I don't understand what do you mean by "Manipulating RowState". The problem
is not whether to call the AcceptChanges for each row or to call the Update
method in order to submit the inserts. The problem is that if I insert a new
record then this record is visible in the user interface only if I call the
Update method (or the Row.AcceptChanges). If I don't call the Update method
then the new row is not visible to the user interface. This situation is an
obstacle in inserting two or more rows and updating the database at the end.
It is common practice in desktop applications when there is a master-detail
relationship between two tables, to update both tables at the same time and
not post changes to the detail table and cancel changes to the master table.
That is what I want to implement.

Regards
Dimitris Milonas


"W.G. Ryan" <WilliamRyan (AT) nospam (DOT) gmail.com> wrote

Quote:
Manimpulating RowState will do it for you. When you call Update, it calls
AcceptChanges on each row as the row is updated. I'm not familiar with
the Details view but you could just call AcceptChanges on the row and it
would be in the same state is if you called Update.

The question is why it's showing. I suspect that once you call Update, the
SELECT query is firing again and that's why it's now visible. Do you hvae
the Refresh Dataset option on when you call Update?
"Dimitris Milonas" <gnout (AT) hotmail (DOT) com> wrote in message
news:Ob1FVtYMIHA.5224 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Hello to all,

I would like to inserts/delete some records from a table and Update the
DataAdapter at the end of all the operations. The problem is that I would
like the intermediate changes to be visible in the User Interface (i.e.
DetailView). I am using the following code:

DataRow DataRow1 = DataSet1.Tables["Table1"].NewRow();

DataRow1["CODE"] = "...";
DataRow1["NAME"] = "...";

DataSet1.Tables["Table1"].Rows.Add(DataRow1);

At this point the new row is not visible to the User Interface. That
means that I have to Update the DataAdapter
(DataAdapter1.Update(DataSet1,"Table1")) in order for the new row to be
visible to User Interface. Is there a way the changes to be visible to
the User Interface before Update the DataAdapter?

Thanks in advance
Dimitris Milonas











Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.