PC Review


Reply
Thread Tools Rate Thread

Autonumber Issue With Access 2007 Database/ADO.NET

 
 
Jeff Gaines
Guest
Posts: n/a
 
      13th Sep 2007

I thought this may help other people learning ADO.NET.

Having, I thought, got a sufficient grip to 'go live' I set up an app
using Access 2007 and ADO.NET. During testing everything worked except my
'AddRecord' function, which kept complaining of a duplicate entry in an
indexed field. After writing and re-writing the app and tearing my hair
out I opened the table in Access, attempted to add a record and got the
same error. So 24 hours of frustration and it wasn't my code. It was the
database - it seemed to think it had only reached record 12 when it has
over 100 records in it. I changed the name of the AutoNumber field, added
a new one, deleted the old one and all works now.

So is lesson 99 check the Database manually if your code should work but
doesn't? As a very newcomer to ADO.NET my natural assumption was I had got
the code wrong!

--
Jeff Gaines
 
Reply With Quote
 
 
 
 
PvdG42
Guest
Posts: n/a
 
      13th Sep 2007
"Jeff Gaines" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I thought this may help other people learning ADO.NET.
>
> Having, I thought, got a sufficient grip to 'go live' I set up an app
> using Access 2007 and ADO.NET. During testing everything worked except my
> 'AddRecord' function, which kept complaining of a duplicate entry in an
> indexed field. After writing and re-writing the app and tearing my hair
> out I opened the table in Access, attempted to add a record and got the
> same error. So 24 hours of frustration and it wasn't my code. It was the
> database - it seemed to think it had only reached record 12 when it has
> over 100 records in it. I changed the name of the AutoNumber field, added
> a new one, deleted the old one and all works now.
>
> So is lesson 99 check the Database manually if your code should work but
> doesn't? As a very newcomer to ADO.NET my natural assumption was I had got
> the code wrong!
>
> --
> Jeff Gaines



Excellent point and reminder
Rule 1 when a query appears not to work in an application is: try it direct
in the database, then look at your code if it works directly, but not via
your app.

 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      14th Sep 2007
Hi Jeff,

Thanks for sharing your experience here.

I'm sure every developer has similiar experience: sometimes something
simple just won't get right. Usually that's a good sign to get some sleep,


Cheers,
Walter Wang ((E-Mail Removed), remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
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
Access 2007--Issue Tracking Database akayski@sbcglobal.net Microsoft Access Forms 4 26th Jun 2008 05:40 PM
Re-Seed Autonumber Field in a Remote Access Database RDub Microsoft Access Form Coding 5 19th May 2008 07:52 AM
insert data into Access database (could it be AutoNumber?) Scott Starker Microsoft ADO .NET 3 20th Apr 2007 03:00 PM
Access database insert statement with an autonumber (identity) in vb.net Cindy H Microsoft VB .NET 7 5th Jun 2006 11:35 PM
insert record in Ms Access database AND retrieve the autonumber (ID) nicholas Microsoft ASP .NET 5 20th Oct 2004 05:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:49 PM.