每日农产品价格行情管理系统_第1页
每日农产品价格行情管理系统_第2页
每日农产品价格行情管理系统_第3页
每日农产品价格行情管理系统_第4页
每日农产品价格行情管理系统_第5页
已阅读5页,还剩20页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、数据库课程设计题目:每日农产品价格行情管理系统专业:信息管理与信息系统班级:一、系统需求解析随着科学技术的发展,社会进步,计算机和互联网技术的迅速发展,信息的流传速度成倍加快。怎样才能迅速正确地掌握市场的最新动向、优异的货源和收买商成为了产品的商家和生产商在商场上立于不败之地的重要保证。农产品这一块也不例外,及时地掌握农产品的每日价格行情成为了农户和农产品批发商的迫切需求。每日农产品价格行情系统就是建立在这样一个基础上,为农户和农产品批发商建立一个认识农产品市场最新动向以及供求信息的平台。系统的主要功能录入、更正和盘问农产品的供求信息(主若是以各个产品的品种种类,产地来划分的产品供求信息)录入

2、、更新和盘问农产品的价格行情信息(上涨或是下跌)给用户赐予权限和信息保护。二、系统功能结构图功能结构图:每日农产品价格销售商基本农产品基本供给商基本信农产品价格信息分类统计汇修查删添修查删添修查删添修查删最最大平改询除加改询按除加改询除加改询除高低宗均按按按按按按品地品地按按最最平三、数据库设计品地种区种区高低均1.系统ER图种区农户名农户编供给供给时供给价产品编产品类产品名产地产品价进货时进货进货价地区电话农户m供地区零售商零售商编n电联系农产零售nm批发时mn进批发商批批发批发价电批发商编联系批发商地区关系模式设计关系模式:农户:(农户编号,农户名,地区,电话)农产品:(产品编号,产品种类

3、,产品名称,产地)批发商:(批发商编号,批发商店名,地区,电话,联系人)零售商:(零售商编号,零售商店名,地区,电话,联系人)供给表(供给编号,农户编号,产品编号,供给量,供给时间,供给价格)进货表(进货编号,产品编号,批发商编号,进货量,进货时间,进货价格)批公布(批发编号,产品编号,批发商编号,零售商编号,批发量,批发时间,批发价格)四、数据字典数据项名字:SupID说明:供给商编号,编码由三位字母和7位数字组成,其名字:SupName中前三位字母是供给商名字的首字母,7位数字是供给时名字:Suparea说明供给商的名称。间和序号的组合,如lzy2011001,2011表示供给时间,001

4、说类明型:供varchar应商的地址。名字SupStyle名字:SupPhonvarchar说明:供给商的种类,001代表农户,002代表承包商。名说字明:供SupPW应商的联系方式种类:int说类明型:供varchar应商密码。名字:ProductID种类:varchar说明:农产品信息编号,编码为2位字母加8位数字,其中名字:ProductName说明:农产品种类,前2位字母表示农产品的名称。2位字母是农产品的首字母,8位数字是农产品供给时间和序说明:农产品的名称。种类:varchar号的名组字合:,ProductOrigin如hg20110001,2011表示供给时间,0001表示序种类

5、:varchar说明:农产品的产地。种类:varchar名字:ProductPrice名字:UserID说明:农产品的价格。说名明字:用UserName户编号,编码为3位字母加7位数字组成,其中种类:money三说位明字:母用是户用名户称的。首字母,7位数字是用户购买产品时间和名字:UserPW序类号型的:组varchar合,如lzy2011001,2011表示购买时间,001表示名字:UserStyle说明:用户的密码。名字:说明:用户的种类。UserPhone种类:varchar名字:UserArea说类明型:用int户的联系方式。说明:用户的地址。varchar名字:DistID名类字型

6、:DistNamevarchar说明:销售商编号,编码为3位字母加7位数字组成,其中名字:Distarea说明:销售商名称。三位字母是销售商的首字母,7位数字是销售商购买产品时间:类说型明:销DistStylevarchar售商的地址。和序号的组合,如xss2011001,2011表示购买时间,001表示种类:varchar说明:销售商的种类,003代表批发商,004代表零售商。名字:DistPhone名类字型:DistPWint说明:销售商联系方式。名字:Cno说明:销售商的密码varchar种类:说明:分类汇总编号类名型字:varcharProductStytle种类:varchar说明:

7、商品种类名字:ProductName说明:商品名称类名型字:varcharHigestPrice名类字型:LowestvarcharPrice说明:最高价说明:最低价名类字型:BulkmoneyPrice类名型字:moneyAvePrice说明:大宗价数据结构:说明:平均价种类:money2.种类:数据结构:money名字:供给商表说明:供给商供给产品时登记的表相关数据流、数据名字:农产品信息表储藏相关数据流、数据说明:产品销售时登记的表说明:用户购买产品时登记的表供给商表名字:销售商表储藏:结构:编号农产品信息表相关数据流、数据名说字明:分类销汇售总商表销售产品时登记的表3.数据储藏农产品信

8、息表用户表说存明储:进行产品汇总时登记的表相关数据流、数结构:编号供给商表名字:供给商表销售商表据储藏:说明:储藏供给商的信息分类汇农总产表品信息表结构编号名字:农产品信息表名字:用户表供给商表结说构明:编存号储农产品的信息说明储藏用户的信息结构:结构(名称)ProductID(编号)五数据库实现结说构明:储藏产品的各种信息数据库表定义UserName(名字)结构DistID:(编号)每日农产品价格管理系统createdatabase每日农产品价格管理系统CnoDistName(编号)(名称)供给商表(Supplier)ProductStyle(产品种类)字段值约字段名字段类长度主键对应中文名

9、型束SupIDvarcha10PNotnull供给商编号rSupNameVarcha25Notnull供给商名称rSupareaVarcha50Notnull供给商地址rSupStyleIntNotnull供给商种类SupPhoneVarcha20Notnull联系方式rSupPWVarcha16Notnull供给商密码rcreatetableSupplier(SupIDvarchar(10)notnullprimarykey,SupNamevarchar(25)notnull,SupAreavarchar(50)notnull,SupStyleintnotnull,SupPhonevarch

10、ar(20)notnull,SupPWVarchar(16)notnull,)农产品信息表(ProductInfo)字段名字段类长度主键字段值对应中文名型拘束ProductIDvarchar10PNotnull农产品编号ProductStylVarchar10Notnull农产品种类eProductNameVarchar50Notnull产品名称ProductOrigVarchar20Notnull产地inProductPricMoneyNotnull产品价格eSupIDvarchar10Notnull供给商编号DistIDvarchar10Notnull销售商编号createtablePro

11、ductInfo(ProductIDvarchar(10)notnullprimarykey,ProductStylevarchar(10)notnull,ProductNamevarchar(50)notnull,ProductOriginvarchar(20)notnull,ProductPricemoneynotnull,SupIDvarchar(10)notnullforeignkeyreferencesSupplier(SupID),DistIDvarchar(10)notnullforeignkeyreferencesDistributer(DistID),)用户表(UserInf

12、o)字段名字段类长度主键字段值约对应中文名型束UserIDvarcha10PNotnull用户编号rUserNameVarcha25Notnull用户名称rUserPWVarcha16Notnull用户密码rUserStylIntNotnull用户种类eUserPhonVarcha20Notnull联系方式erUserAreaVarcha50Notnull用户地址rcreatetableUserInfo(UserIDvarchar(10)notnullprimarykey,UserNamevarchar(25)notnull,UserPWvarchar(16)notnull,UserStyle

13、intnotnull,UserPhonevarchar(20)notnull,UserAreavarchar(50)notnull,)销售商表(Distributer)字段名字段类长度主键字段值约对应中文名型束DistIDvarcha10PNotnull销售商编号rDistNameVarcha25Notnull销售商名称rDistareaVarcha50Notnull销售商地址rDistStylIntNotnull销售商种类eDistPhonVarcha20Notnull联系方式erDistPWVarcha16NotNull销售商密码rcreatetableDistributer(DistID

14、varchar(10)notnullprimarykey,DistNamevarchar(25)notnull,Distareavarchar(50)notnull,DistStyleintnotnull,DistPhonevarchar(20)notnull,DistPWvarchar(16)notnull,)分类汇总表(C_Summery)字段名字段类长度主键字段值约对应中文名型束C_Novarcha10PNotnull分类汇总编号rProductStylVarcha10Notnull商品种类erProductNameVarcha50Notnull商品名称rHigest_PricMoney

15、Notnull最高价eLowest_PricMoneyNotnull最低价eBulk_PriceMoneyNotnull大宗价Ave_PriceMoneyNotnull平均价ProductIDvarcha10Notnull农产品编号rcreatetableC_Summery(C_Novarchar(10)notnullprimarykey,ProductStylevarchar(10)notnull,ProductNamevarchar(50)notnull,Higest_Pricemoneynotnull,Lowest_Pricemoneynotnull,Bulk_Pricemoneynot

16、null,Ave_Pricemoneynotnull,ProductIDvarchar(10)notnullforeignkeyreferencesProductInfo(ProductID),)数据库关系图触发器的编写1、CREATETRIGGERUserInfo_delete1ONUserInfoforDeleteASbegindeleteDistributerfromDistributerdt,deleteddwheredt.DistID=d.UserIDENDGO/*在用户表中删除用户的同时将销售商表中对应的信息删除掉*/2、CREATETRIGGERUserInfo_deleteON

17、UserInfoforDeleteASbegindeleteSupplierfromSuppliersp,deleteddwheresp.SupID=d.UserIDEndGo/*在用户表中删除用户的同时将供给商表中的对应的信息删除掉*/3、CREATETRIGGERUserInfo_insertONUserInfoforinsertASdeclareUserIDvarchar(10),UserNameVarchar(25),UserPWVarchar(16),UserStyleInt,UserPhoneVarchar(20),UserAreaVarchar(50)selectUserID=U

18、serID,UserName=UserName,UserPW=UserPW,UserStyle=UserStyle,UserPhone=UserPhone,UserArea=UserAreafrominsertedwhereUserStyle=001orUserStyle=002begininsertintoSupplier(SupID,SupName,SupPW,SupPhone,SupStyle,SupArea)values(UserID,UserName,UserPW,UserPhone,UserStyle,UserArea)EndGo/*当在用户表中插入的信息中“用户种类”为“001”

19、或“002”时,在供给商表中插入相同的信息*/4、CREATETRIGGERUserInfo_insert1ONUserInfoforinsertASdeclareUserIDvarchar(10),UserNameVarchar(25),UserPWVarchar(16),UserStyleInt,UserPhoneVarchar(20),UserAreaVarchar(50)selectUserID=UserID,UserName=UserName,UserPW=UserPW,UserStyle=UserStyle,UserPhone=UserPhone,UserArea=UserArea

20、FrominsertedwhereUserStyle=003orUserStyle=004begininsertintoDistributer(DistID,DistName,DistPW,DistPhone,DistStyle,DistArea)values(UserID,UserName,UserPW,UserPhone,UserStyle,UserArea)EndGo/*当在用户表中插入的信息中“用户种类”为“003”或“004”时,在销售商表中插入相同的信息*/5、CREATETRIGGERUserInfo_updateONUserInfoforUPDATEASifUpdate(Use

21、rID)BEGINUpdateSuppliersetSupID=i.UserIDfromSuppliersp,deletedd,insertediwheresp.SupID=d.UserIDEndGo/*在用户表更新用户信息时将供给商表中相应的信息进行同步更新*/6、CREATETRIGGERUserInfo_update1ONUserInfoforUPDATEASifUpdate(UserID)BEGINUpdateDistributersetDistID=i.UserIDfromDistributerdt,deletedd,insertediwheredt.DistID=i.UserIDE

22、NDGo/*在用户表更新用户信息时将销售商表中相应的信息进行同步更新*/7、CREATETRIGGERProduct_deleteONProductInfoforDeleteASbegindeleteC_SummeryfromC_Summerycs,deleteddwherecs.ProductName=d.ProductNameENDGo/*在用户表删除农产品信息时将汇总表中相应的信息进行删除*/8、CREATETRIGGERProduct_updateONProductInfoforupdateASbeginupdateC_SummerysetProductName=i.ProductNa

23、mefromC_Summerycs,deletedd,insertediwherecs.ProductName=d.ProductNameENDGo/*在用户表更新农产品信息时将汇总表中相应的信息进行同步更新*/储藏过程归纳:以下全部的储藏过程:插入:表示插入一条新记录(若是记录已经存在,则插入失败)。更正:表示更正一条记录(若是记录存在则更正,否则不能够更正)删除:表示删除一条记录(若是记录存在则删除,否则不能够删除在此,我没有考虑到级联关系,感觉删除这个过程用触发器做比较好,因此,删除应由触发器实现。)。盘问:表示盘问记录(依照盘问条件,显示相应的盘问结果)供给商表的储藏过程:1插入(若是

24、该记录号已经存在,则不能够再插入)Ifexists(selectnamefromsysobjectswherename=add_Supplier)Dropprocedureadd_SupplierGOGOcreateprocedureadd_SupplierSupIDvarchar(10),SupNamevarchar(25),Supareavarchar(50),SupStyleint,SupPhonevarchar(20),SupPWvarchar(16)AsBegintransactionInsertintoSuppliervalues(SupID,SupName,Suparea,Sup

25、Style,SupPhone,SupPW)If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd测试执行上述储藏过程Use每日农产品价格管理Execadd_SupplierSupID=5,SupName=2,Suparea=3,SupStyle=12,SupPhone=4,SupPW=1232更正(依照记录号进行更正,若是记录号不存在则不能够更正。更正时,每个字段都不行以为空,否则更正不了)Ifexists(selectnamefromsysobjectswherename=edit_Supplier)Dropp

26、rocedureedit_Supplier;GOCreateprocedureedit_SupplierSupIDvarchar(10),SupNamevarchar(25),Supareavarchar(50),SupStyleint,SupPhonevarchar(20),SupPWvarchar(16)AsBegintransactionUpdateSuppliersetSupName=SupName,Suparea=Suparea,SupStyle=SupStyle,SupPhone=SupPhone,SupPW=SupPWwhereSupID=SupID;If(error!=0)Be

27、ginRollbacktransactionEndElsebeginCommittransactionEnd调用更正储藏过程:use每日农产品价格管理Execedit_SupplierSupID=2,SupName=aa,Suparea=aa,SupStyle=10,SupPhone=123654,SupPW=111删除(我可是做了个简单的对单个表的记录进行删除)Ifexists(selectnamefromsysobjectswherename=del_Supplier)Dropproceduredel_Supplier;GOCreateproceduredel_SupplierSupIDv

28、archar(10)AsBegintransactionDeletefromSupplierwhereSupID=SupIDIf(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用删除储藏过程:use每日农产品价格管理Execdel_SupplierSupID=4盘问(依照盘问条件,显示结果。条件能够是多个字段的)Ifexists(selectnamefromsysobjectswherename=select_Supplier)Dropprocedureselect_SuppliergoCreateproce

29、dureselect_SupplierSupIDvarchar(10),SupNamevarchar(25),Supareavarchar(50),SupStyleint,SupPhonevarchar(20),SupPWvarchar(16)AsBeginDeclarewherevarchar(100)Declaresqlvarchar(150)SETwhere=ERROR=0If(SupID)setwhere=where+and+SupID=+SupIDif(SupName)setwhere=where+and+SupName=+SupNameif(Suparea)setwhere=whe

30、re+and+Suparea=+Supareaif(SupStyle)setwhere=where+and+SupStyle=+CONVERT(VARCHAR(10),SupStyle)if(SupPhone)setwhere=where+and+SupPhone=+SupPhoneif(SupPW)setwhere=where+and+SupPW=+SupPWsetsql=Select*fromSupplierwhere+wherePRINT+sqlENDbegintransactionexec(sql)If(error0)BeginRollbacktransactionEndElsebeg

31、inCommittransactionEnd调用盘问储藏过程:use每日农产品价格管理Execselect_SupplierSupID=,SupName=,Suparea=,SupStyle=12,SupPhone=,SupPW=(表示详尽值。也能够为空,表示该字段没有要求)农产品信息表的储藏过程(ProductInfo)1插入(若是该记录号已经存在,则不能够再插入)Ifexists(selectnamefromsysobjectswherename=add_ProductInfo)Dropprocedureadd_ProductInfo;GOCreateprocedureadd_Produc

32、tInfoProductIDvarchar(10),ProductStylevarchar(10),ProductNamevarchar(50),ProductOriginvarchar(20),ProductPriceMoney,SupIDvarchar(10),DistIDvarchar(10)AsBegintransactionInsertintoProductInfovalues(ProductID,ProductStyle,ProductName,ProductOrigin,ProductPrice,SupID,DistID)If(error!=0)BeginRollbacktran

33、sactionEndElsebeginCommittransactionEnd调用插入储藏过程:use每日农产品价格管理Execadd_ProductInfoProductID=1,ProductStyle=12,ProductName=12,ProductOrigin=12,ProductPrice=122更正Ifexists(selectnamefromsysobjectswherename=edit_ProductInfo)Dropprocedureedit_ProductInfo;GOCreateprocedureedit_ProductInfoProductIDvarchar(10)

34、,ProductStylevarchar(10),ProductNamevarchar(50),ProductOriginvarchar(20),ProductPriceMoney,SupIDvarchar(10),DistIDvarchar(10)AsBegintransactionUpdateProductInfosetProductStyle=ProductStyle,ProductName=ProductName,ProductOrigin=ProductOrigin,ProductPrice=ProductPrice,SupID=SupID,DistID=DistIDwherePro

35、ductID=ProductID;If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用更正储藏过程:use每日农产品价格管理Execedit_ProductInfoProductID=1,ProductStyle=a,ProductName=a,ProductOrigin=a,ProductPrice=100删除Ifexists(selectnamefromsysobjectswherename=del_ProductInfo)Dropproceduredel_ProductInfoGOCreateproc

36、eduredel_ProductInfoProductIDvarchar(10)AsBegintransactionDeletefromProductInfowhereProductID=ProductIDIf(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用更正储藏过程:use每日农产品价格管理Execdel_ProductInfoProductID=1盘问Ifexists(selectnamefromsysobjectswherename=select_ProductInfo)Dropprocedures

37、elect_ProductInfo;GOCreateprocedureselect_ProductInfoProductIDvarchar(10),ProductStylevarchar(10),ProductNamevarchar(50),ProductOriginvarchar(20),ProductPriceMoney,SupIDvarchar(10),DistIDvarchar(10)AsBeginDeclarewherevarchar(100);Declaresqlvarchar(150);Setwhere=error=0;If(ProductID!=)setwhere=where+

38、and+ProductID=+ProductID;if(ProductStyle!=)setwhere=where+and+ProductStyle=+ProductStyle;if(ProductName!=)setwhere=where+and+ProductName=+ProductName;if(ProductOrigin!=)setwhere=where+and+ProductOrigin=+ProductOrigin;if(ProductPrice!=)setwhere=where+and+ProductPrice=+convert(varchar(15),ProductPrice

39、);if(SupID!=)setwhere=where+and+SupID=+SupID;if(DistID!=)setwhere=where+and+DistID=+DistID;setsql=Select*fromProductInfowhere+where;begintransactionexec(sql)If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionendEnd调用盘问储藏过程:use每日农产品价格管理Execselect_ProductInfoProductID=1,ProductStyle=,Pro

40、ductName=,ProductOrigin=,ProductPrice=用户表的储藏过程(User)1插入Ifexists(selectnamefromsysobjectswherename=add_User)Dropprocedureadd_UserGOCreateprocedureadd_UserUserIDvarchar(10),UserNamevarchar(25),UserPWvarchar(16),UserStyleInt,UserPhonevarchar(20),UserAreavarchar(50)AsBegintransactionInsertintoUservalues

41、(UserID,UserName,UserPW,UserStyle,UserPhone,UserArea)If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd测试执行上述储藏过程use每日农产品价格管理Execadd_UserUserID=1,UserName=1,UserPW=1,UserStyle=12,UserPhone=1234567,UserArea=122更正Ifexists(selectnamefromsysobjectswherename=edit_User)Dropprocedureedit_

42、User;GOCreateprocedureedit_UserUserIDvarchar(10),UserNamevarchar(25),UserPWvarchar(50),UserStyleInt,UserPhonevarchar(20),UserAreavarchar(50)AsBegintransactionUpdateUsersetUserName=UserName,UserPW=UserPW,UserStyle=UserStyle,UserPhone=UserPhone,UserArea=UserAreawhereUserID=UserID;If(error!=0)BeginRoll

43、backtransactionEndElsebeginCommittransactionEnd测试执行上述更正储藏过程use每日农产品价格管理Execedit_UserUserID=1,UserName=2,UserPW=2,UserStyle=22,UserPhone=100,UserArea=320删除Ifexists(selectnamefromsysobjectswherename=del_User)Dropproceduredel_User;GOCreateproceduredel_UserUserIDvarchar(10)AsBegintransactionDeletefromUs

44、erwhereUserID=UserID;If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用更正储藏过程:use每日农产品价格管理Execdel_UserUserID=1盘问Ifexists(selectnamefromsysobjectswherename=select_User)Dropprocedureselect_User;GOCreateprocedureselect_UserUserIDvarchar(10),UserNamevarchar(25),UserPWvarchar(16),User

45、Styleint,UserPhonevarchar(20),UserAreavarchar(50)AsBeginDeclarewherevarchar(150)Declaresqlvarchar(250)Setwhere=error=0If(UserID)setwhere=where+and+UserID=+UserIDif(UserName)setwhere=where+and+UserName=+UserNameif(UserPW)setwhere=where+and+UserPW=+UserPW;if(UserStyle)setwhere=where+and+UserStyle=+con

46、vert(varchar(15),UserStyle)if(UserPhone)setwhere=where+and+ProductPrice=+UserPhoneif(UserArea)setwhere=where+and+UserArea=+UserAreasetsql=Select*fromUserwhere+wherebegintransactionexec(sql)If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionendEnd调用盘问储藏过程:use每日农产品价格管理Execselect_UserUser

47、ID=1,UserName=,UserPW=,UserStyle=,UserPhone=,UserArea=销售商表(Distributer)的储藏过程1插入Ifexists(selectnamefromsysobjectswherename=add_Distributer)Dropprocedureadd_Distributer;GOCreateprocedureadd_DistributerDistIDvarchar(10),DistNamevarchar(25),Distareavarchar(50),DistStyleInt,DistPhonevarchar(20),DistPWvar

48、char(16)AsBegintransactionInsertintoDistributervalues(DistID,DistName,Distarea,DistStyle,DistPhone,DistPW)If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用插入储藏过程:use每日农产品价格管理Execadd_DistributerDistID=1,DistName=1,Distarea=1,DistStyle=11,DistPhone=11,DistPW=1232更正Ifexists(selectn

49、amefromsysobjectswherename=edit_Distributer)Dropprocedureedit_Distributer;GOCreateprocedureedit_DistributerDistIDvarchar(10),DistNamevarchar(25),Distareavarchar(50),DistStyleInt,DistPhonevarchar(20),DistPWvarchar(16)AsBegintransactionUpdateDistributersetDistName=DistName,Distarea=Distarea,DistStyle=

50、DistStyle,DistPhone=DistPhone,DistPW=DistPWwhereDistID=DistID;If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用更正储藏过程:use每日农产品价格管理Execedit_DistributerDistID=1,DistName=1,Distarea=1,DistStyle=11,DistPhone=11,DistPW=3333删除Ifexists(selectnamefromsysobjectswherename=del_Distributer)

51、Dropproceduredel_Distributer;GOCreateproceduredel_DistributerDistIDvarchar(10)AsBegintransactionDeletefromDistributerwhereDistID=DistID;If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用更正储藏过程:use每日农产品价格管理Execdel_DistributerDistID=1盘问Ifexists(selectnamefromsysobjectswherename=sel

52、ect_Distributer)Dropprocedureselect_Distributer;GOCreateprocedureselect_DistributerDistIDvarchar(10),DistNamevarchar(25),Distareavarchar(50),DistStyleInt,DistPhonevarchar(20),DistPWvarchar(16)AsBeginDeclarewherevarchar(150);Declaresqlvarchar(200);Setwhere=error=0;If(DistID)setwhere=where+and+DistID=

53、+DistID;if(DistName)setwhere=where+and+DistName=+DistName;if(Distarea)setwhere=where+and+Distarea=+Distarea;if(DistStyle)setwhere=where+and+DistStyle=+convert(varchar(15),DistStyle);if(DistPhone)setwhere=where+and+DistPhone=+DistPhone;if(DistPW)setwhere=where+and+DistPW=+DistPW;setsql=Select*fromDis

54、tributerwhere+where;begintransactionexec(sql)If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionendEnd调用盘问储藏过程:use每日农产品价格管理execselect_DistributerDistID=,DistName=,DistArea=,DistStyle=,DistPhone=,DistPW=分类汇总表(C_Summery)的储藏过程1插入Ifexists(selectnamefromsysobjectswherename=add_C_Summery)Dro

55、pprocedureadd_C_Summery;GOCreateprocedureadd_C_SummeryC_Novarchar(10),ProductStylevarchar,ProductNamevarchar,Higest_PriceMoney,Lowest_PriceMoney,Bulk_PriceMoney,Ave_PriceMoney,ProductIDvarchar(10)AsBegintransactionInsertintoC_Summeryvalues(C_No,ProductStyle,ProductName,Higest_Price,Lowest_Price,Bulk

56、_Price,Ave_Price,ProductID)If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用插入储藏过程:use每日农产品价格管理Execadd_C_Summery=1,ProductName=1,Higest_Price=1,C_NoLowest_Price=2,ProductStyle=1,Bulk_Price=1,Ave_Price=12更正Ifexists(selectnamefromsysobjectswherename=edit_C_Summery)Dropprocedureedi

57、t_C_Summery;GOCreateprocedureedit_C_SummeryC_Novarchar(10),ProductStylevarchar(10),ProductNamevarchar(50),Higest_PriceMoney,Lowest_PriceMoney,Bulk_PriceMoney,Ave_PriceMoney,ProductIDvarchar(10)AsbegintransactionUpdateC_SummerysetProductStyle=ProductStyle,ProductName=ProductName,Higest_Price=Higest_P

58、rice,Lowest_Price=Lowest_Price,Bulk_Price=Bulk_Price,Ave_Price=Ave_Price,ProductID=ProductIDwhereC_No=C_No;If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用更正储藏过程:use每日农产品价格管理Execedit_C_SummeryC_No=1,ProductStyle=q,ProductName=q,Higest_Price=9,Lowest_Price=9,Bulk_Price=9,Ave_Pri

59、ce=9删除Ifexists(selectnamefromsysobjectswherename=del_C_Summery)Dropproceduredel_C_Summery;GOCreateproceduredel_C_SummeryC_Novarchar(10)AsBegintransactionDeletefromC_SummerywhereC_No=C_No;If(error!=0)BeginRollbacktransactionEndElsebeginCommittransactionEnd调用更正储藏过程:use每日农产品价格管理Execdel_C_SummeryC_No=1盘问Ifexists(selectn

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论