SDAC and sql_variant

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ilgiz

SDAC and sql_variant

Post by ilgiz » Fri 03 Jun 2005 09:26

When I use field with data type sql_variant I get error:

table.fieldbyname('field').value = error: Unknown type: 14

but
table.fieldbyname('field').AsInteger = 1031.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 03 Jun 2005 14:14

This message can be raised in Delphi on try to pass incorrectly generated Variant.
Please specify a full code to fill table.fieldbyname('field').value
Could you pass the same value to the local variable of Variant type?

Guest

Post by Guest » Tue 07 Jun 2005 07:24

CREATE TABLE svariant (
vcode int NULL ,
variant sql_variant NULL
)
GO

insert into svariant
values (1,1030.559)

var v :variant;
begin
msquery1.close;
msquery1.SQL.Text:='select * from svariant';
msquery1.Open;
v:=msquery1.FieldByName('variant').Value;

v - Unknown type: 14
end;

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 07 Jun 2005 12:41

14 corresponds to varDecimal (vt_decimal). Delphi in difference from MS SQL doesn't support this type.

Post Reply