Subject | Creating a Stored Procedure at runtime |
---|---|
Author | Gerhardus Geldenhuis |
Post date | 2001-12-04T08:27:41Z |
Hi
I am trying to run a stored procedure at runtime but am
not succesfull. I cant seem to set the parameters.
I have a feeling I am missing something obvious.
The lines between the question marks is the combinations
that I have tried.
try
SourceSP:=TIB_StoredProc.Create(DMRep);
SourceSP.IB_Connection:=SourceConnetion;
SourceSP.IB_Transaction:=SourceTransaction;
// SourceSP.AutoDefineParams:=true;//has no effect
SourceSP.StoredProcName:='Read_Log_'+SPName;
//?????????
SourceSP.Params.ParamByName('IN_UID').AsString:=UID;//fieldname in_uid
not fournd
sourcesp.ParamByName('in_uid').asstring:=uid;//parameter mismatch
sourcesp.Params.SetColumnValue('IN_UID',UID);//parameter mismatch
//?????????
SourceSP.Prepared:=True;
SourceSp.ExecProc;
finally
SourceSP.Free;
end;//try finally
This code worked but it was for the ibostoredproce and not for the
ib_storedproc:
IBOSP: TIBOStoredProc;
try
IBOSP:=TIBOStoredProc.Create(IBOQ.Owner);
IBOSP.DatabaseName:=IBOQ.DatabaseName;
IBOSP.IB_Transaction:=IBOQ.IB_Transaction;
IBOSP.StoredProcName:=ProcName;
IBOSP.Prepared:=True;
IBOSP.Params[0].AsString:=SC;
IBOSP.Params[1].AsInteger:=Supplier;
IBOSP.Params[2].AsInteger:=List;
IBOSP.Params[3].AsInteger:=Quantity;
IBOSP.ExecProc;
finally
IBOSP.Free;
end;//try finally
Groete
Gerhardus
I am trying to run a stored procedure at runtime but am
not succesfull. I cant seem to set the parameters.
I have a feeling I am missing something obvious.
The lines between the question marks is the combinations
that I have tried.
try
SourceSP:=TIB_StoredProc.Create(DMRep);
SourceSP.IB_Connection:=SourceConnetion;
SourceSP.IB_Transaction:=SourceTransaction;
// SourceSP.AutoDefineParams:=true;//has no effect
SourceSP.StoredProcName:='Read_Log_'+SPName;
//?????????
SourceSP.Params.ParamByName('IN_UID').AsString:=UID;//fieldname in_uid
not fournd
sourcesp.ParamByName('in_uid').asstring:=uid;//parameter mismatch
sourcesp.Params.SetColumnValue('IN_UID',UID);//parameter mismatch
//?????????
SourceSP.Prepared:=True;
SourceSp.ExecProc;
finally
SourceSP.Free;
end;//try finally
This code worked but it was for the ibostoredproce and not for the
ib_storedproc:
IBOSP: TIBOStoredProc;
try
IBOSP:=TIBOStoredProc.Create(IBOQ.Owner);
IBOSP.DatabaseName:=IBOQ.DatabaseName;
IBOSP.IB_Transaction:=IBOQ.IB_Transaction;
IBOSP.StoredProcName:=ProcName;
IBOSP.Prepared:=True;
IBOSP.Params[0].AsString:=SC;
IBOSP.Params[1].AsInteger:=Supplier;
IBOSP.Params[2].AsInteger:=List;
IBOSP.Params[3].AsInteger:=Quantity;
IBOSP.ExecProc;
finally
IBOSP.Free;
end;//try finally
Groete
Gerhardus