PC Review


Reply
Thread Tools Rate Thread

AutoIncrement field and jet

 
 
Julian
Guest
Posts: n/a
 
      17th Mar 2004
Hi

I wish to use a jet data base with an autoincrement field. How do you update
the database with the new rows added to the dataset and get the new
autoincrement number allocated by the db without refreshing the whole
dataset?

Many thanks

Julian


 
Reply With Quote
 
 
 
 
Cor
Guest
Posts: n/a
 
      17th Mar 2004
Hi Julian,

You can try this

da.update(ds)
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(ds)

Cor


 
Reply With Quote
 
William Ryan eMVP
Guest
Posts: n/a
 
      17th Mar 2004
Check out Bill Vaugn's article on Managing an @@Identity Crisis
http://www.betav.com/msdn_magazine.htm (It's geared to SQL Server but the
same principle applies). You don't have to fire a Refresh for the whole
dataset, but each of the items you update, you'll need a SELECT command at
the end of it to get the values back. Remember to set the autoincrement
value to -1 and the seed to 0 so that you don't write the same values if
multiple users are running the app. In the DataAdapterConfiguration Wizard,
there's an option Refresh Dataset that will write the Update Statement for
you...even if you are rolling your own logic, it's a good way to see how
this works.

HTH,

Bill
"Julian" <(E-Mail Removed)> wrote in message
news:c3a8l9$cfs$(E-Mail Removed)...
> Hi
>
> I wish to use a jet data base with an autoincrement field. How do you

update
> the database with the new rows added to the dataset and get the new
> autoincrement number allocated by the db without refreshing the whole
> dataset?
>
> Many thanks
>
> Julian
>
>



 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      18th Mar 2004
On Wed, 17 Mar 2004 19:24:26 -0000, "Julian" <(E-Mail Removed)> wrote:

¤ Hi
¤
¤ I wish to use a jet data base with an autoincrement field. How do you update
¤ the database with the new rows added to the dataset and get the new
¤ autoincrement number allocated by the db without refreshing the whole
¤ dataset?
¤

If you have a Jet 4.0 database (Access 2000 or higher) see the following:

http://msdn.microsoft.com/library/de...mberValues.asp


Paul ~~~ (E-Mail Removed)
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
get next value of an autoincrement field frank Microsoft Access 8 2nd Nov 2006 08:53 AM
Changing an AutoIncrement Field to a Long Integer Field and Back Don Microsoft Access External Data 3 9th Dec 2005 03:23 AM
Changing an AutoIncrement Field to a Long Integer Field and Back Don Microsoft Access Database Table Design 3 9th Dec 2005 03:23 AM
AutoIncrement field Erik Visser Microsoft Access Queries 3 28th Nov 2005 05:51 PM
Autoincrement field in sql Adam Maltby Microsoft ADO .NET 4 28th Oct 2004 10:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:51 AM.