VB调用存储过程
CREATE PROCEDURE sp_compare ASIF (select name from sysobjects where name='TAB_RESULT_FINACE')<>''
DROP TABLE TAB_RESULT_FINACE
SELECT 出庫類別, 出庫單號易做图, [SO No#], 客戶編易做图, 客戶名稱, 客户PO号, 擔當者,
[Invoice Date], 幣別, 金额, 狀態 INTO #TAB_ACCOUNT
FROM TAB_ACCOUNT WHERE (狀態 = N'未易做图') OR (狀態 = N'易做图中')
SELECT TAB_INVOICE.[客户编 号], TAB_INVOICE.[客户名 称],
TAB_INVOICE.[(期末余额)本币] AS 预收余额, sum(case when 金额 is null then 0 else 金额 end)
AS 开票金额, (sum([(期末余额)本币])+sum(case when 金额 is null then 0 else 金额 end)) as 预付款余额
INTO TAB_RESULT_FINACE
FROM TAB_INVOICE LEFT OUTER JOIN #TAB_ACCOUNT ON
TAB_INVOICE.[客户编 号] = #TAB_ACCOUNT.客戶編易做图
GROUP BY TAB_INVOICE.[客户编 号], TAB_INVOICE.[客户名 称],TAB_INVOICE.[(期末余额)本币]
SELECT TAB_RESULT_FINACE.[客户编 号], TAB_RESULT_FINACE.[客户名 称],
TAB_RESULT_FINACE.预付款余额 AS 'U8 预付款余额', SUM(TAB_RESULT.预付款余额) AS 'CS预付款余额',
(CASE WHEN TAB_RESULT_FINACE.预付款余额=SUM(TAB_RESULT.预付款余额) THEN 'TRUE' ELSE 'FALSE' END) AS '比较值'
FROM TAB_RESULT_FINACE LEFT OUTER JOIN
TAB_RESULT ON TAB_RESULT_FINACE.[客户编 号] = TAB_RESULT.[客户编 号]
GROUP BY TAB_RESULT_FINACE.[客户编 号], TAB_RESULT_FINACE.[客户名 称],TAB_RESULT_FINACE.预付款余额
GO
存储过程如上代码,我用VB的数据集调用这个过程,为什么就是打不开这个记录集呢?过程是没问题的就是读取不到数据,是什么问题呢?
Set oRst = New ADODB.Recordset
cn1.CursorLocation = adUseClient
Set oRst = cn1.Execute("exec sp_compare")
补充:VB , 基础类