Saving Data

Posted on 2004-10-27
Last Modified: 2010-04-23
In vb6 I had a function which would insert/update record(s). What I am looking for is the best way to duplicate this in
The function would accept a disconnected recordset which contained one or more updated or inserted records. It would then create a connection to the relevant database, set the active connection for the passed thru disconnected recordset to the connection and then updatebatch would be used (rs.updatebatch adaffectall). This function would then sit in a dll and could be called from any app. ADOR recordsets were used.

So basically what I want to do in is something similar to the above. Any advice on how I should go about this would be greatly appreciated.

What I have at the moment are a couple of forms with grids and unbound controls on them. The user can add/edit records using the unbound controls. On the save event I want to do something similar as before in vb6. Put the data into a disconnected recordset and call a routine that will perform the update/insert for me.
Question by:azrakdragon
    LVL 10

    Accepted Solution

    You can use a DataAdapter and a datagrid to implement this functionality. DataAdapter fills a dataset that can be used as the datasource of the datagird. U can make additions,deletions and updates on the datagrid. Then call the dataset.GetChanges to get all the changes. Then call update method of the dataAdapter to transfer the records to the database.

    U can use the followings.

    Author Comment

    Unfortunately the requirements are such that no changes may be made directly on the datagrid. All changes/additions are to be made using the unbound controls.

    Author Comment

    Looking at the link u sent me, there is enough info for me to write something reusable. Many thanks for the help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now