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

XE2: store, restore variant in clientdatset blob field

Status
Not open for further replies.

DiRi

Programmer
Mar 21, 2012
1
0
0
DE
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!!





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top