www.pudn.com > Fr3ReportDLL.rar > JLKProcedureUnit.pas


unit JLKProcedureUnit; 
 
interface 
 
procedure JLKAddParameterName(ProcedureNameIndex: Integer; 
        const ParameterName: WideString); 
 
procedure JLKAddParameterValue(ProcedureNameIndex: Integer; 
        const AddParameterValue: WideString; 
        AddParameterIndex: Integer); 
 
procedure JLKAddProcedureName(ProcedureNameIndex: Integer; 
        const pProcedureName: WideString); 
 
procedure JLKExecProc(ProcedureNameIndex: Integer); 
 
procedure JLKAddParameterNameValue(ProcedureNameIndex: Integer; 
        const AddParameterName, AddParameterValue: WideString); 
 
implementation 
 
uses UnitMain, 
        SysUtils, 
        Dialogs, 
        ADODB, 
        DB; 
//------------------------------------------------------------------------------- 
//执行存储过程并返回到存储数据集1-5 
//date:2005-04-07 
//------------------------------------------------------------------------------- 
//添加存储过程参数名称 
 
procedure JLKAddParameterName(ProcedureNameIndex: Integer; 
        const ParameterName: WideString); 
begin 
        try 
                if (ProcedureNameIndex > 0) and (ProcedureNameIndex < QueryNum) then begin 
                        with FrmMain.ADOStoredProc[ProcedureNameIndex] do begin 
                                Parameters.AddParameter.Name := ParameterName; 
                        end; 
                end; 
        except 
                on E: Exception do begin 
                end; 
        end; 
end; 
//添加存储过程参数值 
 
procedure JLKAddParameterValue(ProcedureNameIndex: Integer; 
        const AddParameterValue: WideString; AddParameterIndex: Integer); 
begin 
        try 
                if (ProcedureNameIndex > 0) and (ProcedureNameIndex < QueryNum) then begin 
                        with FrmMain.ADOStoredProc[ProcedureNameIndex] do begin 
                                Parameters[AddParameterIndex].Value := Trim(AddParameterValue); 
                        end; 
                end; 
        except 
                on E: Exception do begin 
                end; 
        end; 
end; 
//添加存储过程名称 
 
procedure JLKAddProcedureName(ProcedureNameIndex: Integer; 
        const pProcedureName: WideString); 
begin 
        try 
                if (ProcedureNameIndex > 0) and (ProcedureNameIndex < QueryNum) then begin 
                        with FrmMain.ADOStoredProc[ProcedureNameIndex] do begin 
                                Close; 
                                ProcedureName := pProcedureName; 
                        end; 
                end; 
        except 
                on E: Exception do begin 
                end; 
        end; 
end; 
//执行存储过程 
 
procedure JLKExecProc(ProcedureNameIndex: Integer); 
begin 
        try 
                if (ProcedureNameIndex > 0) and (ProcedureNameIndex < QueryNum) then begin 
                        with FrmMain.ADOStoredProc[ProcedureNameIndex] do begin 
                                Prepared; 
                                Active := true; 
                                ExecProc; 
                        end; 
                end; 
        except 
                on E: Exception do begin 
                end; 
        end; 
end; 
 
procedure JLKAddParameterNameValue(ProcedureNameIndex: Integer; 
        const AddParameterName, AddParameterValue: WideString 
        ); 
begin 
        try 
                if (ProcedureNameIndex > 0) and (ProcedureNameIndex < QueryNum) then begin 
                        with FrmMain.ADOStoredProc[ProcedureNameIndex] do begin 
                                Parameters.AddParameter.Name := Trim(AddParameterName); 
                                Parameters.ParamByName(AddParameterName).Value := Trim(AddParameterValue); 
                        end; 
                end; 
        except 
                on E: Exception do begin 
                end; 
        end; 
end; 
//------------------------------------------------------------------------------- 
 
//------------------------------------------------------------------------------- 
end.