Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Receiving "Key column is insufficent..." error in VB6 UpdateBatch

Status
Not open for further replies.

tg0001

Programmer
Jul 14, 2003
2
US
I have been receiving a &quot;Key column information is insufficient or incorrect. Too many rows were affected by update&quot; error. I get this error on the <Recordset>.UpdateBatch method in VB when it is executed for a master table associated with another tables (via primary keys/foreign keys) in a SQL Server 2000 Database.

The relationship between the tables is a one-to-many relationship in most cases. The relationship is generally set up as the following on the relationship properties between the tables in SQL Server 2000:
* Enforce relationship for replication
* Enforce relationship for INSERTs and UPDATEs

Since I am using the <Recordset>.UpdateBatch method to update the master table, I am not able to see the SQL of the method to fully determine why the &quot;Key column...&quot; error occurs. This method is a predefined method in Microsoft Visual Basic 6.

But, I have viewed primary keys on records in the <Recordset> using the Print command in the Immediate window (i.e. Print <Recordset>.Fields(&quot;<FieldName>&quot;).Value). There are actual values for the keys and they seem to be correct.

What is a good work around in Visual Basic 6 for this problem? If you have any ideas, please let me know.

Thanks.
 
Your question is not clear.

This problem is when u do this:
select *from emp;

*note: without moveing to a single record when u do this
with adodc1.recordset
.update &quot;Blah&quot;, strBlah
.update &quot;Blah&quot;, strBlah
.update &quot;Blah&quot;, strBlah
.requery
end with

*Note: another is when the object is linked with database

*note : when u update go to the specific record and then update it. when u are adding then add anywhere. and when u are useing any mask edit box then do clear the mask and then update /edit , there is some problem in your datasource / update method. check those out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top