Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dataset update/insert issue

Status
Not open for further replies.

hayt

IS-IT--Management
Oct 5, 2004
132
US
I am using a dataset connectet to an access db (for testing). The way in which i process updates and deletes is to send the sql to the db (using executenonquery) and update the datarow in the dataset. it works great! my only problem is that when i process an insert (the sql works great) i don't know how to update the dataset. i need the key (db autonumber) in order to process other functions, and to make the insterted row visible to the user immediately.

i seem to remember reading (a long time ago) about a way to tell a dataset to go and get any changes. this would be ideal since the db is going to be used by several users at once, and i can get the changes that others make as well. can anyone tell me how to do this?

thanks,

hayt


PS - i give Stars!
 
Check out this link:

Retrieving Identity or Autonumber Values

The first part deals with SQL Server, but about halfway through the article it talks about Access.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
thanks for the link, unfortunately, i do not handle inserts that way. i use direct sql commands because my app will work with access, sql server, mysql and firebird db. as a result, i am using the odbc conenction.

also, is there a way to get the updates of other users? new rows, updates, deletes, etc?
 
i have been trying to rewrite my code to follow the example, but it just isn't taking. it gives me a primary key null error in the rows.add(newRow) method.

there are several tables that i make changes to, and i have one class that makes the changes to the db through sql. i'd love to maintain this, and reload the dataset, but i do not want to refill the dataset comepletely, just any new entries and/or changes to the datasource.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top