Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting TParams to ADO TParameters

Status
Not open for further replies.

OhDelphi

Programmer
Nov 14, 2012
1
GB
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;
 
Hi OhDelphi,

I need more information from you:

- what delphi version are you using?
- can you tell me which line throws the typecast error (step thorugh with the debugger)?

/Daddy


-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top