Updating and inserting records using a disconnected recordset

Updating and inserting records using a disconnected recordset

Post by Mike Lerc » Thu, 26 Sep 2002 01:07:25



I'm still new to ADO.NETand have a question.  Assuming that there's an
equivalent of a disconnected recordset in ADO.NET, is it possible to
do either of the following:

- Grab a row (or rows) from a database, disconnect from the database,
present the row (or rows) to the user to edit, then reconnect to the
database and update it with the user's changes

- Don't connect with the database at all, have the user enter stuff in
the proper schema, then connect with the database and insert a new row
(or rows)

Can ADO.NET do this and if so how?  Any help or pointers to stuff to
read would be greatly appreciated!

Lerch

 
 
 

Updating and inserting records using a disconnected recordset

Post by Kevin Spence » Thu, 26 Sep 2002 02:44:48


Yes, using a DataSet, which is a disconnected RecordSet with all the
functionality you've described, and a good bit more.

HTH,

--
Kevin Spencer
Microsoft FrontPage MVP
Internet Programmer
http://www.takempis.com
Big things are made up of lots of little things.


Quote:> I'm still new to ADO.NETand have a question.  Assuming that there's an
> equivalent of a disconnected recordset in ADO.NET, is it possible to
> do either of the following:

> - Grab a row (or rows) from a database, disconnect from the database,
> present the row (or rows) to the user to edit, then reconnect to the
> database and update it with the user's changes

> - Don't connect with the database at all, have the user enter stuff in
> the proper schema, then connect with the database and insert a new row
> (or rows)

> Can ADO.NET do this and if so how?  Any help or pointers to stuff to
> read would be greatly appreciated!

> Lerch


 
 
 

1. Inserting Virtual Records Using the Update Command of the Data Adapter...

I have a form that has a form/subform architecture.  Each form
represents an estimate (textboxes/controls on the form) and each
estimate has many phases (datagrid) depending on the estimate type.

What Im doing is building a virtual record in the background when the
user adds a new estimate.  This pre-populates the datagrid with the
appropriate phases and builds the two datatables that will hold both
the mainform/subform parts.  Neither will have an ESTIMATE ID yet at
this point.

The strategy during the update is to save the main-form data first,
then get the new ESTIMATE ID that it created in the database and then
save the phases information last using the ESTIMATE_ID foreign key.

The reason being, we dont want people accidentally creating records if
they cancel out of doing an estimate.

I'm assuming since the data I'm creating in these datatables doesnt
actually exist in the database yet (just pulled from various look-up
tables), I would actually have to put an INSERT SQL STATEMENT in the
UPDATE COMMAND of the data adapter.  Logic suggests I'm updating the
information in the datatables and  not really inserting new DATATABLE
rows...

Is this logical?  Or am I thinking incorrectly?

2. Dealers, developers, Dillulo

3. Updating disconnected recordsets

4. The baby is 70% born

5. Disconnected (connectionless) ADO recordsets using JScript

6. syquest 135 - pc to mac

7. Disconnected Recordsets using C#

8. Looking for xDSL in NY in a month or two. Suggestions

9. How to update or insert a record

10. Sample or example of insert, update and delete of records (not datagrid)

11. SQL Stored Proc and Multiple records to Update/Insert?

12. How to update/delete/insert records to SQL server wit VB.NET?

13. "Template" for insert and update of records?