I'm using a clientdataset to store variables with values at runtime:
Field1 : VName (string80) (Primary index)
Field2 : VValue (blob)
The following procedure is well executed in Delphi6 - XE2(32 bit) causes error: "Variant..couldn't be converted.." in line {*}
procedure TfMain.ButtonClick(Sender: TObject);
var V : Variant;
I : integer;
begin
cdsVBox.CreateDataSet;
//STORE INTEGER-VARIABLE:
I:=123;
cdsVBox.Append;
cdsVBoxVNAME.AsString:='INT_A';
cdsVBoxVVALUE.AsVariant:=I;
cdsVBox.Post;
cdsVBox.MergeChangeLog;
//RESTORE THE SAME VARIABLE:
if cdsVBox.FindKey(['INT_A']) then
begin
{*} I:=cdsVBOXVVALUE.asVariant;
messagedlg('INT_A='+inttostr(I),mtInformation,mbok],0);
end;
cdsVBox.close;
end;
There is no datatype, this code operates with XE2.
Also I get similar errors using function strtofloat..
In Delphi 6 everything works finest - so where is the problem?
Is it a XE2-bug? Maybe a compiler option is responsible?
Best regards and thanks in advance for any help!!
Field1 : VName (string80) (Primary index)
Field2 : VValue (blob)
The following procedure is well executed in Delphi6 - XE2(32 bit) causes error: "Variant..couldn't be converted.." in line {*}
procedure TfMain.ButtonClick(Sender: TObject);
var V : Variant;
I : integer;
begin
cdsVBox.CreateDataSet;
//STORE INTEGER-VARIABLE:
I:=123;
cdsVBox.Append;
cdsVBoxVNAME.AsString:='INT_A';
cdsVBoxVVALUE.AsVariant:=I;
cdsVBox.Post;
cdsVBox.MergeChangeLog;
//RESTORE THE SAME VARIABLE:
if cdsVBox.FindKey(['INT_A']) then
begin
{*} I:=cdsVBOXVVALUE.asVariant;
messagedlg('INT_A='+inttostr(I),mtInformation,mbok],0);
end;
cdsVBox.close;
end;
There is no datatype, this code operates with XE2.
Also I get similar errors using function strtofloat..
In Delphi 6 everything works finest - so where is the problem?
Is it a XE2-bug? Maybe a compiler option is responsible?
Best regards and thanks in advance for any help!!