Page 1 of 1

Delphi2005. E2010 Incompatible types: 'Object' and 'Integer' when assigning integer constant to a OracleParameter.Value

Posted: Thu 09 Jun 2005 05:07
by Guest
I have following code in Delphi 2005.

Code: Select all

unit dDocumentMain;
interface
uses
	Borland.Vcl.SysUtils, Borland.Vcl.Classes, System.Data, System.ComponentModel,
	Borland.Vcl.Db, cExtprocTesterClasses, Contnrs, Variants, CoreLab.Common,
	CoreLab.Oracle, Borland.Vcl.Math;
[...]
type
[...]
TDocumentMain = class(TDataModule)
[...]
procedure TestProcedure(const P:OracleCommand; out Result:String);
[...]
end;
[...]
implementation
[...]
procedure TDocumentMain.TestProcedure(const P: OracleCommand;
	out Result: String);
resourcestring
	pnOperation='OPERATION';
[...]
var
	opCurrent:OracleParameter;
	I:Integer;
begin
	[...]
	try
		for I:=0 to P.Parameters.Count-1 do
			begin
				opCurrent:=P.Parameters[I];
				if SameText(opCurrent.ParameterName,pnOperation) then
					begin
						opCurrent.Value:=-1;
						Continue;
					end;
[...]
When i compile this code i receive following error:
[Error] dDocumentMain.pas(311): E2010 Incompatible types: 'Object' and 'Integer' on the line "opCurrent.Value:=-1;"

I'm just started to do .NET programming so i cannot understand what is wrong? Why Value declared as "Object" instead of "Variant" or something like this? How can i set parameter of certain type, if this parameter already in the Parameters collection?

Posted: Mon 13 Jun 2005 12:40
by Paul

Code: Select all

opCurrent.Value:=TObject(-1);

Posted: Tue 14 Jun 2005 05:35
by ender
But this is not comfortable to cast each assigned value to TObject. :(

Posted: Thu 16 Jun 2005 07:42
by Oleg
We don't have such problem with Delphi 2005 Update Pack 2.
Try to install Update Pack 2 for Delphi 2005.

Posted: Thu 16 Jun 2005 07:46
by ender
It is installed. I'm noticed that you have examples as WinForms applications, but i'm use OraDirect.NET in VCL.NET apps.

Posted: Thu 16 Jun 2005 08:00
by Oleg
Obviously you have described a problem of Delphi 2005 compiler.
We have a product for VCL - ODAC. It works with VCL.NET as well.