Subject | Re: [ib-support] Fwd: Need your Help |
---|---|
Author | Helen Borrie |
Post date | 2001-12-28T23:08:38Z |
At 05:42 PM 28-12-01 -0500, "essa alarusie" wrote:
Presumably, in the first operation (inserting the original three records) the DBExplorer used the Insert method of the TQuery, for which it would have employed a statement like this:
insert into aTable(Number, Days)
values( :Number, :Days);
In order to go back and plug in values for iMonth and iYear in those three records, it would have needed to compose an Update statement for EACH record, similar to
update aTable
set iMonth = :iMonth,
iYear = :iYear
where <criteria to uniquely identify a record>
Your problem here is that you don't have a unique key on the record structure you created for the table, so InterBase returns an error to the application, to the effect that it can't find the records to update.
It's a bit hard to discern just what you attempted to do, but if, instead of attempting to update the existing records, you tried to insert, something like this:
insert into aTable(Number, Days, iMonth, iYear)
values( :Number, :Days, :iMonth, iYear);
while using the same values for Number and for Days, as you previously did, then you would get "duplicate" records, since there is nothing about the columns Number and Days that says they have to be unique. If there were, you would have been unable to perform this insert - you would have received a Key Violation error.
cheers,
Helen
>>I am DELPHI programmer, I create my database by Interbase Client & Server.Were you trying to use Insert to update the columns in existing records?
>>- I created table that contains of four fields ( Number, Days, IMonth,
>>IYear). From explorer of Database into DELPHI, I manually inserted values
>>for tow fields, as following:
>> Number Days IMonth IYear
>> 1 1
>> 1 1
>> 2 1
>>after few minutes, I was trying to insert values to Other ( IMonth,
>>IYear) fields in the first and second record. I could not...
Presumably, in the first operation (inserting the original three records) the DBExplorer used the Insert method of the TQuery, for which it would have employed a statement like this:
insert into aTable(Number, Days)
values( :Number, :Days);
In order to go back and plug in values for iMonth and iYear in those three records, it would have needed to compose an Update statement for EACH record, similar to
update aTable
set iMonth = :iMonth,
iYear = :iYear
where <criteria to uniquely identify a record>
Your problem here is that you don't have a unique key on the record structure you created for the table, so InterBase returns an error to the application, to the effect that it can't find the records to update.
It's a bit hard to discern just what you attempted to do, but if, instead of attempting to update the existing records, you tried to insert, something like this:
insert into aTable(Number, Days, iMonth, iYear)
values( :Number, :Days, :iMonth, iYear);
while using the same values for Number and for Days, as you previously did, then you would get "duplicate" records, since there is nothing about the columns Number and Days that says they have to be unique. If there were, you would have been unable to perform this insert - you would have received a Key Violation error.
cheers,
Helen