By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,827 Members | 2,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,827 IT Pros & Developers. It's quick & easy.

C# and Access

P: 1
I have a weird problem with C# and an access database. I have a table with a primary key set to autonumber. I allowed C# to create the tableadapter, binding srouce, navagator, etc.

The data navigatort has am ADD button. When I click on add, it will create a new recrod but it someitmes creates a primary key that has been used and deleted previosuly which of course access will not allow. Then I cannot save the record.

Weird. I woudl have thought that C# gets the key from the access database. Any ideas on hwo to correc tthis issue?

THanks
CM
Mar 2 '07 #1
Share this Question
Share on Google+
1 Reply


MMcCarthy
Expert Mod 10K+
P: 14,534
I have a weird problem with C# and an access database. I have a table with a primary key set to autonumber. I allowed C# to create the tableadapter, binding srouce, navagator, etc.

The data navigatort has am ADD button. When I click on add, it will create a new recrod but it someitmes creates a primary key that has been used and deleted previosuly which of course access will not allow. Then I cannot save the record.

Weird. I woudl have thought that C# gets the key from the access database. Any ideas on hwo to correc tthis issue?

THanks
CM
I can't comment on the C# end of it but when adding a record in Access and the Primary key is an autonumber you ignore this field entirely in the INSERT statement. Access handles it automatically.

Mary
Mar 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.