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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADOTble problem

Status
Not open for further replies.

MLNorton

Programmer
Nov 15, 2009
134
US
I have a Procedure tha contains the following code:

With ADOTable2 do
begin
first;
active := true;
for I := 1 to 52 do
begin
edit;
ADOTable2.FieldByName('Week').AsString := teNameArray;
ADOTable2.FieldByName('DateName').AsString := WeekNameArray;
ADOTable2.FieldByName('WeekName').AsString := WeekArray;
ADOTable2.FieldByName('Collect').AsInteger := 0;
ADOTable2.FieldByName('Visitor').AsInteger := 0;
ADOTable2.FieldByName('Unresolved').AsString := '';
post;
next;
end;
end;

When I run it I get the following error when I = 1 when post is executed.

Project Project2.exe raised exception class EDataBaseError with message, ‘Key column information is insufficient or incorrect. Too many rows affected by update’.
The Arrays are all verified as correct. The ADOTable2 contains 52 records and 6 fields. ADOTable 1 uses the same ADOConnection and it runs with no problem. The ADOTable2 is an Access 2010 database.
I have been using ADOTables for over 10 years in programs and I have never seen this error before. I am running Delphi 7 on a Windows 7 machine.
What is my problem and what is the solution?
 
Problem solved by asdding an Index to the Access Table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top