ASE SP order of parameter creation
Posted: Tue 26 May 2015 20:44
Hello!
Here, at my workplace, we are using ASE 15.
Actually we are trying to convert some projects from BDE to UniDAC. Until now every single non-visual BDE component (TStoredProc) is being correctly "translated" to UniDAC however, there are one implementation where we are using a generic TStoredProc, i.e., we are using the component at runtime, setting the correct properties, creating the necessary parameters and doing an Open.
On BDE, the parameters creation can be made on any order, but now, we figured that UniDAC is using the parameters by their positions not by their names. We arrived at this conclusion when some codifications raised runtime errors asking for conversion from "varchar" to "integer". After some deep debug we saw that exchanging the order of creation of the parameters we achieved success.
Now the question: UniDAC does not uses the name of parameters to assign it before to call a procedure? We have this impression...
The code above works, because the order of added parameters is the same of the procedure creation (below)
Exchanging the second and first parameters raises an exception telling about conversion, because these parameters are integer and varchar and they are incompatibles, of course. So, something is being done erroneously?
Delphi 2006
UniDAC 4.1.6
ASE 15 (server) / ASE 12.5 (client)
Here, at my workplace, we are using ASE 15.
Actually we are trying to convert some projects from BDE to UniDAC. Until now every single non-visual BDE component (TStoredProc) is being correctly "translated" to UniDAC however, there are one implementation where we are using a generic TStoredProc, i.e., we are using the component at runtime, setting the correct properties, creating the necessary parameters and doing an Open.
On BDE, the parameters creation can be made on any order, but now, we figured that UniDAC is using the parameters by their positions not by their names. We arrived at this conclusion when some codifications raised runtime errors asking for conversion from "varchar" to "integer". After some deep debug we saw that exchanging the order of creation of the parameters we achieved success.
Now the question: UniDAC does not uses the name of parameters to assign it before to call a procedure? We have this impression...
Code: Select all
STPRAux.StoredProcName := 'dbo.p_select_unidade;1';
with TParam(STPRAux.Params.Add) do
begin
Name := '@sigla';
DataType := ftString;
ParamType := ptInput;
Value := Null;
end;
with TParam(STPRAux.Params.Add) do
begin
Name := '@codg';
DataType := ftInteger;
ParamType := ptInput;
Value := Null;
end;
with TParam(STPRAux.Params.Add) do
begin
Name := '@dscr';
DataType := ftString;
ParamType := ptInput;
Value := Null;
end;
STPRAux.Open;
Code: Select all
CREATE PROC p_select_unidade (@sigla VARCHAR(20) IN, @codg INT IN, @dscr VARCHAR(120) IN)
Delphi 2006
UniDAC 4.1.6
ASE 15 (server) / ASE 12.5 (client)