存儲過程如下:
ALTER PROCEDURE pro_rang_inf
@as_orderno varchar(20),
@as_rangeno varchar(20),
@as_matsno varchar(50),
@as_type char(1),
@as_type1 char(1), --材料或印花
@re_rep_qty decimal(9,2) output, --報欠數量
@re_pur_qty decimal(9,2) output, --採購數量
@re_deliver datetime output, --預計交期
@re_conf datetime output, --確認交期
@re_use_qty decimal(9,2) output, --已使用數量
@re_rep_qty2 decimal(9,2) output --其它訂單報欠數量
AS
--取得F&C訂單號
declare @ls_orderno varchar(20), @ls_matsno varchar(50)
select @ls_orderno = order_no
from Sample_Order
where LEFT(order_no,1) = @as_type
and order_range = @as_rangeno
and order_type like 'F&C%'
--取得此材料報欠數量、採購數量、預計交期和確認交期
if @as_type1 = 'A'
begin
select @re_rep_qty = report_qty from Report_Mats
where order_no = @ls_orderno
and mats_description = @as_matsno
--取得採購數量
select @re_pur_qty = purchase_qty,@re_deliver = ex_date,@re_conf = deliver_date
from dbo.Purchase_Mats
where order_no = @ls_orderno
and mats_description = @as_matsno
--取得同系列訂單其它訂單的需求量和報欠數量
select @re_use_qty = sum(isnull(mats_qty,0)),@re_rep_qty2 = sum(isnull(report_qty,0))
from Sample_Order,Report_Mats
where Sample_Order.order_no = Report_Mats.order_no
and left(Sample_Order.order_no,1) = @as_type
and order_range = @as_rangeno
and Sample_Order.order_type not like 'F&C%'
and Sample_Order.order_no <> @as_orderno
end
else
begin
select @re_rep_qty = print_qty,@re_deliver = sourcing_reply_delivery from print_process
where order_no = @ls_orderno
and print_no= @as_matsno
end
PB調用如下:
declare pr_c1 procedure for dbo.pro_rang_inf
@as_orderno = :is_order,
@as_rangeno = :ls_rangeno,
@as_matsno = :ls_matno,
@as_type = :ls_type,
@as_type1 = 'A' using sqlca;
execute pr_c1;
if sqlca.sqlcode <> 0 then
messagebox("錯誤:","錯誤信息"+ sqlca.SQLErrText)
return 1
end if
fetch pr_c1 into :ld_rep_qty,:ld_pur_qty,:ldt_deliver_date,:ld_conf_date,:ld_use_qty,:ld_rep_qty2;
close pr_c1;
當在程序運行時,系統會報如下的錯誤信息:
pro_rang_inf expects parameter [email protected]_rep_qty', which was not supplied
請問問題出在那兒,謝謝!
------解决方案--------------------
看上去存储过程里报错嘛
------解决方案--------------------
PB中調用存儲過程的代碼貼出來看看!
------解决方案--------------------
先去调试下存储过程看看
------解决方案--------------------
declare sp_xxxx procedure for
sp_xxxx(x,x,x,x,....);
execute sp_xxxx;
------解决方案--------------------
13.调用SQL Server存储过程问题(通过ODBC连接sqlserver数据库调用存储过程并获得return或output的值)
1、新建一个standard class,并在select standard class type 中选择transaction,这时会打开一个声明函数的窗口
2、在上面的窗口上选择底部的 Declare instance variables 页,在变量类型的下拉框中选择 Local External Functions
3、在空白处右键选择aste -> SQL->remote stored procedure,回出现选择存储过程的窗口,选择即可生成函数
如: CREATE PROCEDURE sp_test (@pinput varchar(10))
AS
return 1000
GO
选择sp_test的时候生成如下函数声明
function long sp_test(string pinput) RPCFUNC ALIAS FOR "dbo.sp_test"
4、保存你的对象为:uo_tran
5、双击打开应用,选择additional properties ->variable types,修改SQLCA中的 transaction为uo_tran即可