ADO AddNew not updating identity field

I have a VB6 application that has been in production for some time.  But now the .AddNew/.Update is throwing an error 'Cannot insert the value NULL into <column name>', where <column name> is defined as an Identity column.  Has always worked fine,, but now it is failing.

It appears from the message that the .AddNew is not incrementing and populating the column prior to the .Update.

Any ideas?
mdreedAsked:
Who is Participating?
 
mdreedAuthor Commented:
There was a change to our server which caused a problem.  Once I identified and made the server correction everything worked fine.

Thanks for trying to help.
0
 
LIONKINGCommented:
The "increment" of the identity column is not performed by the vb6 application, it's done by the SQL Server.

Does this fail always or only on certain conditions? Have you tried adding a "test" row from within SQL? Does it generate the identity value? Are you still within the limit of the Identity field datatype?
0
 
mdreedAuthor Commented:
I added a test/dummy row via SSMS and the identity column populated correctly.
It happens with every .addnew.  Again, it has worked in the past.
The identity column is INT and the total rows are only ~3000.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
LIONKINGCommented:
If there haven't been "any" changes in the VB code, there's no apparent reason for it to stop working.

After you do .AddNew, do you assign a value to the identity column (i.e. NULL)?

*EDIT* Grammar.
0
 
mdreedAuthor Commented:
I do not populate the identity column.  It has always updated automatically.  Is there anything in SQL Server that could have changed that would prevent the program from working properly re: addnew?
0
 
mdreedAuthor Commented:
Was not a programming or SQL Server issue, but instead was pointing to the wrong server.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.