when CachedUpdates=True,submission bulletin " Key violation.
when CachedUpdates=True,submission bulletin " Key violation.
Delphi7, UniDac 3.0.0.8, Win2003, MSSQL2000
create table dbo.tOrderDtl (
nItem numeric(4) not null,
nGoodsID numeric(8) not null,
nOrderQty numeric(16,3) not null default 0
constraint PK_TORDERDTL primary key nonclustered (nItem)
)
my sql is:
select Item = od.nItem,
GoodsID = od.nGoodsID,
OrderQty = od.nOrderQty
from tOrderDtl od
where od.sStoreNO = 'S110'
and od.sPaperNO = 'S110201004145000'
i use a UniQuery,
Set
CachedUpdates := True
LocalUpdate := True
Options.RequiredFields := False;
Options.SetFieldsReadOnly := False;
The path of the control is:
DBGrid-> DataSource-> ClientDataSet-> DataSetProvider-> UniQuery.
When I enter 1 in GoodsID field of the form, then move the cursor to the next line, enter 2 in the GoodsID field,
then move the cursor to the next line again, it pop error: "Key violation."
for it checks the Item fields of two records are both empty and thinks they're repeated.
But now my setting is "CachedUpdate", I don't like to trigger this inspection.
In addition, when DBGrid-> DataSource-> UniQuery, the above operation is well, no error.
And when the DBGrid-> DataSource-> ClientDataSet-> DataSetProvider-> ADOQuery (or BDEQuery), not error either.
I don't know which caused the problem, or where may I set to shield this inspection?
create table dbo.tOrderDtl (
nItem numeric(4) not null,
nGoodsID numeric(8) not null,
nOrderQty numeric(16,3) not null default 0
constraint PK_TORDERDTL primary key nonclustered (nItem)
)
my sql is:
select Item = od.nItem,
GoodsID = od.nGoodsID,
OrderQty = od.nOrderQty
from tOrderDtl od
where od.sStoreNO = 'S110'
and od.sPaperNO = 'S110201004145000'
i use a UniQuery,
Set
CachedUpdates := True
LocalUpdate := True
Options.RequiredFields := False;
Options.SetFieldsReadOnly := False;
The path of the control is:
DBGrid-> DataSource-> ClientDataSet-> DataSetProvider-> UniQuery.
When I enter 1 in GoodsID field of the form, then move the cursor to the next line, enter 2 in the GoodsID field,
then move the cursor to the next line again, it pop error: "Key violation."
for it checks the Item fields of two records are both empty and thinks they're repeated.
But now my setting is "CachedUpdate", I don't like to trigger this inspection.
In addition, when DBGrid-> DataSource-> UniQuery, the above operation is well, no error.
And when the DBGrid-> DataSource-> ClientDataSet-> DataSetProvider-> ADOQuery (or BDEQuery), not error either.
I don't know which caused the problem, or where may I set to shield this inspection?
I track should be under this method throw
procedure TCustomClientDataSet.InternalPost;
begin
inherited;
if State = dsEdit then
Check(FDSCursor.ModifyRecord(ActiveBuffer)) else
Check(FDSCursor.InsertRecord(ActiveBuffer));
Check(FDSCursor.InsertRecord(ActiveBuffer));
But FDSCursor.InsertRecord is a interface(IDSCursor), did not know that UniDAC does have realizes specifically?
procedure TCustomClientDataSet.InternalPost;
begin
inherited;
if State = dsEdit then
Check(FDSCursor.ModifyRecord(ActiveBuffer)) else
Check(FDSCursor.InsertRecord(ActiveBuffer));
Check(FDSCursor.InsertRecord(ActiveBuffer));
But FDSCursor.InsertRecord is a interface(IDSCursor), did not know that UniDAC does have realizes specifically?
FDSCursor.InsertRecord doesn't execute any UniQuery methods.
The problem occurs because SQL Server returns key flag for the nItem field, and therefore UniDAC returns this field by the IProviderSupport(DataSet).PSGetKeyFields method. ADO returns empty string by PSGetKeyFields for some obscure reason.
The problem occurs because SQL Server returns key flag for the nItem field, and therefore UniDAC returns this field by the IProviderSupport(DataSet).PSGetKeyFields method. ADO returns empty string by PSGetKeyFields for some obscure reason.
WOW, I do not need to update this model back to the database, do not need TClientDataSet.ApplyUpdates,
I just used as a entry in the UI interface only,
I just know that I was CachedUpdates mode, I do not want to help me verify what "Key violation"
But I used to connect BDEQuery or ADOQuery ClientDataSet no such problems, we say the "Key violation" has nothing to do with Unidac it?
Give me a little solution? I just want to ignore this check only?
I just used as a entry in the UI interface only,
I just know that I was CachedUpdates mode, I do not want to help me verify what "Key violation"
But I used to connect BDEQuery or ADOQuery ClientDataSet no such problems, we say the "Key violation" has nothing to do with Unidac it?
Give me a little solution? I just want to ignore this check only?
Now, I method will make DBAccess.pas PSGetKeyFields the following revision not to spring that to be wrong.
function TCustomDADataSet.PSGetKeyFields: string;
var
i: integer;
KeyFieldDescs: TFieldDescArray;
QO: boolean;
QOInfo: TQuickOpenInfo;
begin
Result := '';
Exit;
...
...
But this question you can provide a switch?
function TCustomDADataSet.PSGetKeyFields: string;
var
i: integer;
KeyFieldDescs: TFieldDescArray;
QO: boolean;
QOInfo: TQuickOpenInfo;
begin
Result := '';
Exit;
...
...
But this question you can provide a switch?