當(dāng)前位置: 首頁 » 綜合資訊 » 收單pos機(jī) » POS機(jī)流量卡 »

Vb6 調(diào)用Mysql存儲過程

發(fā)布日期:2014-10-13  中國POS機(jī)網(wǎng)
Vb6 調(diào)用Mysql存儲過程 sqlstr = "call Stor_InOutMat(" & selck & "," & Val(Label20.Caption) & "," & Val(Text10) & "," & czymc & "," & Trim(Text11) & "," & czyid & ")" cn.Execute sqlstr 帶參數(shù)的Mysql存儲過程 CREATE DEFINER=`root`@`localhost` PROCEDURE `Stor_InOutMat`(IN indeportCode varchar(30), IN inmateId int,IN Num int,IN InName varchar(20) charset utf8,IN InRemark varchar(50) charset utf8,IN InUseId int) BEGIN set @ServerDT=sysdate(); select count(mateid) into @aa from materialios where trim(Depotcode)=trim(indeportCode) and mateid=inmateId; if @aa=0 then /* 無庫存記錄,直接加一條入倉或出倉記錄 */ begin if num>0 then insert into materialios(mateid,depotcode,IOSDateTime,AddNum,SubNum,OverNum,UserName,Remark,UserId) values(inmateId,indeportCode,@ServerDT,Num,0,Num,InName,InRemark,InUseId); /* 入倉 */ else insert into materialios(mateid,depotcode,IOSDateTime,AddNum,SubNum,OverNum,UserName,Remark,UserId) values(inmateId,indeportCode,@ServerDT,0,0-Num,Num,InName,InRemark,InUseId); -- 出倉-- end if; end; else /* 以前有庫存記錄,查詢庫存量后再出入倉及更改庫存量 */ begin select max(ID) into @lasttime from materialios where trim(Depotcode)=trim(indeportCode) and mateid=inmateId; select OverNum into @OverNum from materialios where ID=@lasttime; /*select max(IOSDateTime) into @lasttime from materialios where trim(Depotcode)=trim(indeportCode) and mateid=inmateId; /* 最后的出入倉時間*/ /*select OverNum into @OverNum from materialios where Depotcode=indeportCode and mateid=inmateId and IOSDateTime=@lasttime; /* 現(xiàn)有庫存量*/ if num>0 then insert into materialios(mateid,depotcode,IOSDateTime,AddNum,SubNum,OverNum,UserName,Remark,UserId) values(inmateId,indeportCode,@ServerDT,Num,0,@OverNum+Num,InName,InRemark,InUseId); /* 入倉 */ else insert into materialios(mateid,depotcode,IOSDateTime,AddNum,SubNum,OverNum,UserName,Remark,UserId) values(inmateId,indeportCode,@ServerDT,0,0-Num,@OverNum+Num,InName,InRemark,InUseId); -- 出倉-- end if; end; end if; DROP TEMPORARY TABLE IF EXISTS lstjb; CREATE TEMPORARY TABLE lstjb SELECT mateid,depotcode,max(iosdatetime) as maxti from materialios group by mateid,depotcode; select sum(overnum) into @LastNum from lstjb,materialios where materialios.mateid=lstjb.mateid and materialios.depotcode=lstjb.depotcode and materialios.iosdatetime=lstjb.maxti and materialios.mateid=inmateId; update mate_inf set numbers=@LastNum where Id= inmateId; END;
打賞
 
?
免責(zé)聲明:
本網(wǎng)站部分內(nèi)容來源于網(wǎng)站會員、合作媒體、企業(yè)機(jī)構(gòu)、網(wǎng)友提供和互聯(lián)網(wǎng)的公開資料等,僅供參考。本網(wǎng)站對站內(nèi)所有資訊的內(nèi)容、觀點(diǎn)保持中立,不對內(nèi)容的準(zhǔn)確性、可靠性或完整性提供任何明示或暗示的保證。如果有侵權(quán)等問題,請及時聯(lián)系我們,我們將在收到通知后第一時間妥善處理該部分內(nèi)容。

圖文推薦

您在本欄的歷史瀏覽
熱門資訊

中國POS機(jī)行業(yè)權(quán)威門戶網(wǎng)站 引領(lǐng)行業(yè)發(fā)展


微信號:pos580com

網(wǎng)站首頁 | 網(wǎng)站地圖 | 誠征英才 | 關(guān)于我們 | 聯(lián)系方式 | 使用協(xié)議 | 版權(quán)隱私 | 排名推廣 | 廣告服務(wù) | 積分換禮 | 網(wǎng)站留言 | RSS訂閱

版權(quán)所有:POS機(jī)網(wǎng) 北京瑞紀(jì)華人科技有限公司 京ICP證060984  |  京ICP備07503063號

聯(lián)系電話:010-51658061 E-mail:bjsale#pos580.com(請把#替換成@)在線QQ:841617225

站所有信息均屬本站版權(quán)所有,如需轉(zhuǎn)載請注明來源地址 域名:theelitecare.com