Page 1 of 1
I can not get param value when Param.DataType = ftVariant
Posted: Fri 31 Oct 2008 02:28
by Tugrul Tamturk
Hi,
I want to get parameter with variant type from UniSQL.. When I set
for i := 0 to UniSql.Params.Count-1 do begin
UniSql.Params.ParamType := ptInputOutput;
UniSql.Params.DataType := ftVariant;
end;
UniSql.Execute;
This Code cause "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
Parameter[0] :KEYPARAM - invalid ParamType (Status = 1h)."
With ADODB.AdoCommand component, I can use ftVariant Params for get values...
Do you support this usage style?
Thanks.
UniSql and AdoCommand do not produce same result
Posted: Sun 02 Nov 2008 05:52
by Tugrul Tamturk
Hi,
I wrote a comparing code as follow:
procedure TForm1.Button2Click(Sender: TObject);
var V : Variant; S : String;
begin
//UNIDAC : Taking date type field value as variant parameter
UniSQL1.SQL.Text := 'SELECT :PR = ADATEFIELDNAME FROM ATABLE WHERE ATABLEID=123';
UniSQL1.Params[0].ParamType := ptInputOutput;
UniSQL1.Params[0].DataType := ftVariant;
UniSQL1.Execute;
V := UniSQL1.Params[0].Value;
S := VarToStr(V);
Memo1.Lines.Add('UniSql > Value: '+ S + ' :'+ VarTypeAsText(VarType(V)));
//ADO : Same code for ADO
ADOCommand1.CommandText := 'SELECT :PR = ADATEFIELDNAME FROM ATABLE WHERE ATABLEID=123';
ADOCommand1.Parameters[0].Direction := pdInputOutput;
ADOCommand1.Parameters[0].DataType := ftVariant;
ADOCommand1.Execute;
V := ADOCommand1.Parameters[0].Value;
S := VarToStr(V);
Memo1.Lines.Add('AdoCmd > Value: '+ S + ' :'+ VarTypeAsText(VarType(V)));
end;
And results are not same..
UniSql > Value: Aug 1 2008 10:07PM :OleStr
AdoCmd > Value: 01.08.2008 22:07:49 :Date
As I understand, ftVariant type parameter is not supported properly in UNIDAC... ADOCommand detect fieldtype correctly and get parameter value as Date type, and put into variant variable..
This is very sad.. Because this flexibility is very important for my project.
I adapt lots of code, and now I stop and wait for the solution...
I am waiting for Devart team support...
Is Devart Support Team working?
Posted: Tue 04 Nov 2008 12:34
by Tugrul Tamturk
I sent this problem to Devart Support.. But after 2 days no response!
Posted: Tue 04 Nov 2008 13:31
by Dimon
The point is that if parameter type is set to variant, SQL Server returns parameter value as OleString.
In order to solve this problem you can set ParamType to ftDateTime otherwise you should call the Prepare method before calling Execute.
Parameter Types
Posted: Wed 05 Nov 2008 19:02
by Tugrul Tamturk
Thanks, it works..