Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ADO AddNew not updating identity field

Posted on 2012-08-31
6
Medium Priority
?
1,137 Views
Last Modified: 2012-09-05
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?
0
Comment
Question by:mdreed
  • 4
  • 2
6 Comments
 
LVL 13

Expert Comment

by:LIONKING
ID: 38354355
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
 

Author Comment

by:mdreed
ID: 38354379
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
 
LVL 13

Expert Comment

by:LIONKING
ID: 38354416
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:mdreed
ID: 38354479
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
 

Accepted Solution

by:
mdreed earned 0 total points
ID: 38354808
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
 

Author Closing Comment

by:mdreed
ID: 38367120
Was not a programming or SQL Server issue, but instead was pointing to the wrong server.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question