ALTER     proc GetDepartmentName 
--定义参数
@DepartmentID varchar(10),--账户编号
@DepartmentName varchar(100)='' out,--账户名称
@Subject_ID varchar(10)='' out,--科代码
@AccountType varchar(50)='' out,--账户类型
@Interest varchar(50)='' out,--记自息标志
@Noall int=0 out,--未满页标志
@Rate float=0 out,--利息
@AccountMode varchar(50)='' out,--账户状态(1:正常,2:销户,3:冻结)
@J_Product decimal(18,2)=0 out,--借方积数
@D_Product decimal(18,2)=0 out,--贷方积数
@Balance decimal(18,2)=0 out,--账户余额
@ShortID varchar(4)='' out--账户顺序码
as
declare @DB_AccountMode integer--账户状态标志
declare @DB_AccountType integer--账户性质
declare @DB_Interest integer--计息标志select @DepartmentName=Department_Name,@DB_AccountMode=AccountMode, 
       @Subject_ID=Subject_ID,@DB_AccountType=AccountType,@DB_Interest=Interest,
       @Noall=Noall,@Rate=Rate,@J_Product=J_Product,@D_Product=D_Product,
       @Balance=Balance,@ShortID=ShortID
      from Department where department_ID=@departmentid
if @@rowcount=1
begin
if @DB_AccountMode=2
begin
  raiserror('该账户已销户,不能进行业务操作!',16,-1)
  return -1
end
        else
        begin
          begin
          if @DB_AccountMode=1
           set @AccountMode='正常'
          else if @DB_AccountMode=3
           set @AccountMode='销户'
          end
          begin
          if @DB_AccountType=1
    set @AccountType='一般存款户'
  else
  if @DB_AccountType=2
    Set @AccountType='内部账户'
  else
  if @DB_AccountType=3
    set @AccountType='只收账户'
  else
    set @AccountType='只付账户'
          end
          begin
          if @DB_Interest=0
            set @Interest='不计息'
          else
          if @DB_Interest=1
            Set @Interest='按月'
          else
          if @DB_Interest=2
            set @Interest='按季'
          else
          if @DB_Interest=3
            Set @Interest='按半年'
          else
          if @DB_Interest=4
            Set @Interest='按年'
          end
        end
     
end
else
begin
        raiserror('没有找到该账户!',16,-1)
        return -1
end在运行时,如果输入的没有该账代码,提示正常,多试几次就会ntdll.dll错误,他程序类型值错误,但我查了半天,就没查出来问题??

解决方案 »

  1.   

    没有问题啊!declare 
    @DepartmentID varchar(10),--账户编号
    @DepartmentName varchar(100),--账户名称
    @Subject_ID varchar(10),--科代码
    @AccountType varchar(50),--账户类型
    @Interest varchar(50),--记自息标志
    @Noall int,--未满页标志
    @Rate float,--利息
    @AccountMode varchar(50),--账户状态(1:正常,2:销户,3:冻结)
    @J_Product decimal(18,2),--借方积数
    @D_Product decimal(18,2),--贷方积数
    @Balance decimal(18,2),--账户余额
    @ShortID varchar(4) --账户顺序码Set @DepartmentID = '12345'exec GetDepartmentName 
    @DepartmentID, 
    @DepartmentName output,
    @Subject_ID output,
    @AccountType output,
    @Interest output,
    @Noall output,
    @Rate output,
    @AccountMode output,
    @J_Product output,
    @D_Product output,
    @Balance output,
    @ShortID output--------------返回消息服务器: 消息 50000,级别 16,状态 1,过程 GetDepartmentName,行 73
    没有找到该账户!
      

  2.   

    我把程序代码发你你看看:
    dm.spGetDepartmentName.ExecProc;
        lbl_Subject_ID.Caption:=dm.spGetDepartmentName.Parameters.ParamValues[
          '@Subject_ID'];
        lbl_JF_JS.Caption:=FloatToStr(dm.spGetDepartmentName.Parameters.ParamValues[
          '@J_Product']);
        lbl_Short_ID.Caption:=DM.spGetDepartmentName.Parameters.ParamValues[
          '@ShortID'];
        lbl_DF_JS.Caption:=FloatToStr(dm.spGetDepartmentName.Parameters.ParamValues[
          '@D_Product']);
        lbl_Name.Caption:=DM.spGetDepartmentName.Parameters.ParamValues[
          '@DepartmentName'];
        lbl_ACcountType.Caption:=DM.spGetDepartmentName.Parameters.ParamValues[
          '@AccountType'];
        lbl_Rate.Caption:=FloatToStr(Dm.spGetDepartmentName.Parameters.ParamValues['@Rate']);
        lbl_AccountMode.Caption:=dm.spGetDepartmentName.Parameters.ParamValues[
          '@AccountMode'];
        lbl_Interest.Caption:=dm.spGetDepartmentName.Parameters.ParamValues[
          '@Interest'];
        lbl_Balance.Caption:=FloatToStr(dm.spGetDepartmentName.Parameters.ParamValues[
          '@Balance']);
      

  3.   

    我把程序代码发你你看看:
    dm.spGetDepartmentName.ExecProc;
        lbl_Subject_ID.Caption:=dm.spGetDepartmentName.Parameters.ParamValues[
          '@Subject_ID'];
        lbl_JF_JS.Caption:=FloatToStr(dm.spGetDepartmentName.Parameters.ParamValues[
          '@J_Product']);
        lbl_Short_ID.Caption:=DM.spGetDepartmentName.Parameters.ParamValues[
          '@ShortID'];
        lbl_DF_JS.Caption:=FloatToStr(dm.spGetDepartmentName.Parameters.ParamValues[
          '@D_Product']);
        lbl_Name.Caption:=DM.spGetDepartmentName.Parameters.ParamValues[
          '@DepartmentName'];
        lbl_ACcountType.Caption:=DM.spGetDepartmentName.Parameters.ParamValues[
          '@AccountType'];
        lbl_Rate.Caption:=FloatToStr(Dm.spGetDepartmentName.Parameters.ParamValues['@Rate']);
        lbl_AccountMode.Caption:=dm.spGetDepartmentName.Parameters.ParamValues[
          '@AccountMode'];
        lbl_Interest.Caption:=dm.spGetDepartmentName.Parameters.ParamValues[
          '@Interest'];
        lbl_Balance.Caption:=FloatToStr(dm.spGetDepartmentName.Parameters.ParamValues[
          '@Balance']);
      

  4.   

    小罗,程序没有问题的.我在程序连续运行很多很多次,(模拟没有帐户的情况).
    ntdll.dll的问题很复杂.有很多原因引起,你有没有试过在其他机器上运行?