문제

My configuration:

Delphi XE
Firebird 2.1
IBObjects 4.9.12
Windows 7 64bits

I get an exception when I try to set a value to a IBOQuery parameter ("Could not convert variant of type (UnicodeString) into type (Double)").

The exception is raised from TIB_Column.SetAsVariant procedure in IB_Components.pas (line 42795). To create this situation, just try to pass a string to a date parameter:

myQuery.paramByName('mydate').AsString := DateToStr(IncDay(Now,5));

During last 25 days I'm trying to solve this situation, but in IBO support list I've got no answers.
Someone have an idea?

도움이 되었습니까?

해결책

IBObjects's architecture is converting(at a moment of execution) all parameters, fields, etc to String or Variants. If your 'mydate' parameter is 'DateTime'(numeric) type then you must fill it up with a corespondent type value. Is not logic to fill an 'numeric' type parameter with a string...

try this

myQuery.paramByName('mydate').AsDateTime:= Now+5; //is the same as David's answer.

or

myQuery.paramByName('mydate').AsFloat:=Now+5; //or IncDay(Now,5)

Best regards,
Radu

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top