起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 824|回复: 2

TStoredProc组件的用法案例

[复制链接]
发表于 2005-12-6 10:23:56 | 显示全部楼层 |阅读模式
var
  lStoreProc: TStoredProc;
begin
  Result := true;
  lStoreProc := TStoredProc.Create(nil);
  try
    lStoreProc.ConnectionString := TPublicClassLib.GetStoredProcConnectionStr;
    lStoreProc.StoredProcName := 'P_PurchaseStockPlan';    //存储过程的名字
    lStoreProc.Params.ParamByName('I_RANDOMID').AsString := ARandomID;  //参数
    lStoreProc.Params.ParamByName('I_WHCODE').AsString := AWhcode; //参数
    lStoreProc.Params.ParamByName('I_INVCLASS').AsString := AInvClass; //参数
    lStoreProc.Params.ParamByName('I_INVCODE').AsString := AInvCode; //参数
    try
      lStoreProc.Execute;  //执行存储过程
    except
      raise Exception.Create('存储过程执行错误!!');
      Result := false;
    end;
  finally
    lStoreProc.Free;
  end;
回复

使用道具 举报

 楼主| 发表于 2005-12-6 10:24:54 | 显示全部楼层
需要指定如下图所示的数据库引擎:

aa2.jpg

21.82 KB, 下载次数: 271

回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-12-6 10:26:59 | 显示全部楼层
这个控件可以调用oracle中的包里的函数或者过程,代码如下:

StoredProc1.StoredProcName:='PK1.DEL_DATA' ;
StoredProc1.Params[0].AsString:='402';
StoredProc1.Execute;
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2024-4-25 10:23 , Processed in 0.044321 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表