J
Jeff Gaines
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!
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!