欢迎,客人 | 请登录 | 免费注册 | 忘记密码?

 
当前位置: 首页 » 综合资讯 » 收单pos机 » POS机流量卡 »

Vb6 调用Mysql存储过程

发布日期:2014-10-13  中国POS机网
Vb6 调用Mysql存储过程 sqlstr = "call Stor_InOutMat(" & selck & "," & Val(Label20.Caption) & "," & Val(Text10) & "," & czymc & "," & Trim(Text11) & "," & czyid & ")" cn.Execute sqlstr 带参数的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; /* 现有库存量*/ 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;
打赏
 

免责声明:
本网站部分内容来源于网站会员、合作媒体、企业机构、网友提供和互联网的公开资料等,仅供参考。本网站对站内所有资讯的内容、观点保持中立,不对内容的准确性、可靠性或完整性提供任何明示或暗示的保证。如果有侵权等问题,请及时联系我们,我们将在收到通知后第一时间妥善处理该部分内容。

图文推荐

您在本栏的历史浏览
热门资讯

中国POS机行业权威门户网站 引领行业发展


微信号:pos580com

网站首页 | 网站地图 | 诚征英才 | 关于我们 | 联系方式 | 使用协议 | 版权隐私 | 排名推广 | 广告服务 | 积分换礼 | 网站留言 | RSS订阅

版权所有:POS机网 北京瑞纪华人科技有限公司 京ICP证060984  |  京ICP备07503063号

联系电话:010-51658061 E-mail:bjsale#pos580.com(请把#替换成@)在线QQ:841617225

站所有信息均属本站版权所有,如需转载请注明来源地址 域名:www.pos580.com