I use this code from whosrdaddy back in 06/08/04. But I keep getting typecast errors {same problem as ehamlin}. Any help?
Code as below:
function ConvertToADOParms(Owner: TADOStoredProc; aParams: TParams): TParameters;
var i: integer;
begin
// Convert a standard TParams object to an ADO-specific TParameters object
Result :=nil;
try
if aParams = nil then exit;
Result :=TParameters.create( Owner, TParameter);
for i:=0 to aParams.count - 1 do
begin
if aParams = nil then continue;
with Result.AddParameter do
begin
Name := aParams.Name;
Datatype :=aParams.DataType;
Direction :=TParameterDirection(aParams.ParamType);
Size :=aParams.size;
Value :=aParams.value;
end;
end;
except
on e:exception do
begin
Result :=nil;
showmessage('Could not convert standard parameter object to ADO parameter object: '+e.message);
end;
end;
end;
Code as below:
function ConvertToADOParms(Owner: TADOStoredProc; aParams: TParams): TParameters;
var i: integer;
begin
// Convert a standard TParams object to an ADO-specific TParameters object
Result :=nil;
try
if aParams = nil then exit;
Result :=TParameters.create( Owner, TParameter);
for i:=0 to aParams.count - 1 do
begin
if aParams = nil then continue;
with Result.AddParameter do
begin
Name := aParams.Name;
Datatype :=aParams.DataType;
Direction :=TParameterDirection(aParams.ParamType);
Size :=aParams.size;
Value :=aParams.value;
end;
end;
except
on e:exception do
begin
Result :=nil;
showmessage('Could not convert standard parameter object to ADO parameter object: '+e.message);
end;
end;
end;