Y
Yang.SZ
Unregistered / Unconfirmed
GUEST, unregistred user!
存储过程:CREATE PROCEDURE P_STORE_BACKDEALER@BILLNO CHAR(15),@REGISTRAR CHAR(4),@TABLENAME VARCHAR(50),@USINGSYS CHAR(6)ASDECLARE @ERRMSG VARCHAR(255)SELECT KIND FROM VIEW_TEMP_STORE WHERE BILLNO = @BILLNO AND TABLENAME = @TABLENAME GROUP BY KINDIF @@ROWCOUNT > 1 BEGIN SELECT @ERRMSG = '错误,返厂项目种类过多!' GOTO ERROR1 ENDSELECT DEALER FROM VIEW_TEMP_STORE WHERE BILLNO = @BILLNO AND TABLENAME = @TABLENAME GROUP BY DEALERIF @@ROWCOUNT > 1 BEGIN SELECT @ERRMSG = '错误,返厂药品公司过多!' GOTO ERROR1 ENDBEGIN TRANSACTION STORE_BACKDEALER INSERT INTO STORE_BACKDEALER( BILLNO,NUMBER,PRODUCETIMES,SCALAR,PRICE,SALES, PRODUCEDATE,VALIDDATE,DEALER,REGISTRAR ) SELECT BILLNO,NUMBER,PRODUCETIMES,SCALAR,PRICE,SALES,PRODUCEDATE,VALIDDATE, (SELECT NUMBER FROM INFO_PRODUCT_DEALER WHERE DEALER = TEMP_STORE.DEALER), @REGISTRAR FROM TEMP_STORE WHERE BILLNO = @BILLNO AND TABLENAME = @TABLENAMEIF @@ERROR != 0 BEGIN SELECT @ERRMSG = '错误,写入返厂表时出错!' GOTO ERROR2 END UPDATE WAREROOM_STORE_WESTERN SET WAREROOM_STORE_WESTERN.SCALAR = WAREROOM_STORE_WESTERN.SCALAR - TEMP_STORE.SCALAR FROM TEMP_STORE WHERE TEMP_STORE.BILLNO = @BILLNO AND TEMP_STORE.TABLENAME = @TABLENAME AND WAREROOM_STORE_WESTERN.NUMBER = TEMP_STORE.NUMBER AND WAREROOM_STORE_WESTERN.PRODUCETIMES = TEMP_STORE.PRODUCETIMES AND WAREROOM_STORE_WESTERN.SALES = TEMP_STORE.SALESIF @@ERROR != 0 BEGIN SELECT @ERRMSG = '错误,更新库存表时出错!' GOTO ERROR2 END ENDCOMMIT TRANSACTION STORE_BACKDEALERRETURN 0ERROR1: SELECT @ERRMSG = 'ERROR:' + @ERRMSG RAISERROR(@ERRMSG , 16 , 1) RETURN -1/*********************************************/ERROR2: ROLLBACK TRANSACTION STORE_BACKDEALER SELECT @ERRMSG = 'ERROR:' + @ERRMSG RAISERROR(@ERRMSG , 16 , 1) RETURN -1/*********************************************/GODELPHI: ADOQuery1.Close; ADOQuery1.SQL.Text:= 'EXECUTE P_STORE_BACKDEALER '; ADOQuery1.SQL.Text:= ADOQuery1.SQL.Text + '@BILLNO = ''XY0000201000002'', '; ADOQuery1.SQL.Text:= ADOQuery1.SQL.Text + '@REGISTRAR = ''0000'', '; ADOQuery1.SQL.Text:= ADOQuery1.SQL.Text + '@TABLENAME = ''Frm_BackDealer'', '; ADOQuery1.SQL.Text:= ADOQuery1.SQL.Text + '@USINGSYS = ''西药库'''; ADOQuery1.ExecSQL;*******************测试时发现 在SQL的查询分析器显示结果里 有报错提示 但是DELPHI里却没有显示出来 而测试另一个存储过程时 写法和这个完全一样 却有错误返回提示 大家谁能说说这是为什么啊??