• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

Saving Data

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 vb.net.
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 vb.net 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.
0
azrakdragon
Asked:
azrakdragon
  • 2
1 Solution
 
123654789987Commented:
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.
http://www.vb-helper.com/howto_net_datagrid.html
0
 
azrakdragonAuthor Commented:
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.
0
 
azrakdragonAuthor Commented:
Looking at the link u sent me, there is enough info for me to write something reusable. Many thanks for the help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now