Assertion failure with sdac 7.01 in direct mode
Posted: Wed 03 Dec 2014 21:50
exception class : EAssertionFailed
exception message : Assertion failure (D:\Projects\Delphi\Dac\Common\Source\MemData.pas, line 2880).
main thread ($7e0):
0071cdde +016a PEANUTS.exe MemData TData.GetFieldData
0079da06 +01ba PEANUTS.exe CRAccess TCRRecordSet.GetFieldData
0071d03c +00c4 PEANUTS.exe MemData TData.GetField
00735287 +007f PEANUTS.exe MemDS TMemDataSet.GetFieldData
0073507b +0013 PEANUTS.exe MemDS TMemDataSet.GetFieldData
006f6894 +0038 PEANUTS.exe Data.DB 13030 +2 TDataSet.GetFieldData
00735099 +0011 PEANUTS.exe MemDS TMemDataSet.GetFieldData
006e4301 +00a1 PEANUTS.exe Data.DB 5025 +9 TField.GetData
006e6ca3 +007f PEANUTS.exe Data.DB 6147 +5 TWideStringField.GetValue
006e6b36 +001e PEANUTS.exe Data.DB 6124 +1 TWideStringField.GetAsVariant
00a6a1bc +00b4 PEANUTS.exe newutils2 1456 +15 Updt
The actual routine which allows me to move values between datasets based on the field names.
The source is a tmsquery and the destination is a dbisam table. This only happens in direct mode. If I change to prauto (which will be oledb) it works fine.
Here is the actual routine:
Procedure Updt(Sr, ds: TDataSet);
Var
wsd: AnsiString;
Values: VARIANT;
Names: Tstrings;
iFields, iField, ifield2: integer;
itable, otable: TDataSet;
rr: integer;
Begin
Names := TStringlist.Create;
itable := TDataSet(Sr);
otable := TDataSet(ds);
otable.disablecontrols;
itable.disablecontrols;
otable.edit;
With itable Do
Begin
iFields := FieldCount - 1;
Values := VarArrayCreate([0, iFields], varVariant);
itable.GetFieldNames(Names);
For iField := 0 To iFields Do
Begin
Values[iField] := Fields[iField].Value; //<- This is where the exception occurs
End;
ifield2 := 0;
For iField := 0 To iFields Do
Begin
Try
If otable.FindField(Names[iField]) <> Nil Then
If otable.FieldByName(Names[iField]).canmodify = true Then
otable.FieldByName(Names[iField]).Value := Values[iField];
Except
End;
End;
End;
otable.post;
otable.enablecontrols;
itable.enablecontrols;
Names.Free;
End;
exception message : Assertion failure (D:\Projects\Delphi\Dac\Common\Source\MemData.pas, line 2880).
main thread ($7e0):
0071cdde +016a PEANUTS.exe MemData TData.GetFieldData
0079da06 +01ba PEANUTS.exe CRAccess TCRRecordSet.GetFieldData
0071d03c +00c4 PEANUTS.exe MemData TData.GetField
00735287 +007f PEANUTS.exe MemDS TMemDataSet.GetFieldData
0073507b +0013 PEANUTS.exe MemDS TMemDataSet.GetFieldData
006f6894 +0038 PEANUTS.exe Data.DB 13030 +2 TDataSet.GetFieldData
00735099 +0011 PEANUTS.exe MemDS TMemDataSet.GetFieldData
006e4301 +00a1 PEANUTS.exe Data.DB 5025 +9 TField.GetData
006e6ca3 +007f PEANUTS.exe Data.DB 6147 +5 TWideStringField.GetValue
006e6b36 +001e PEANUTS.exe Data.DB 6124 +1 TWideStringField.GetAsVariant
00a6a1bc +00b4 PEANUTS.exe newutils2 1456 +15 Updt
The actual routine which allows me to move values between datasets based on the field names.
The source is a tmsquery and the destination is a dbisam table. This only happens in direct mode. If I change to prauto (which will be oledb) it works fine.
Here is the actual routine:
Procedure Updt(Sr, ds: TDataSet);
Var
wsd: AnsiString;
Values: VARIANT;
Names: Tstrings;
iFields, iField, ifield2: integer;
itable, otable: TDataSet;
rr: integer;
Begin
Names := TStringlist.Create;
itable := TDataSet(Sr);
otable := TDataSet(ds);
otable.disablecontrols;
itable.disablecontrols;
otable.edit;
With itable Do
Begin
iFields := FieldCount - 1;
Values := VarArrayCreate([0, iFields], varVariant);
itable.GetFieldNames(Names);
For iField := 0 To iFields Do
Begin
Values[iField] := Fields[iField].Value; //<- This is where the exception occurs
End;
ifield2 := 0;
For iField := 0 To iFields Do
Begin
Try
If otable.FindField(Names[iField]) <> Nil Then
If otable.FieldByName(Names[iField]).canmodify = true Then
otable.FieldByName(Names[iField]).Value := Values[iField];
Except
End;
End;
End;
otable.post;
otable.enablecontrols;
itable.enablecontrols;
Names.Free;
End;