《库存管理系统课程设计.doc》由会员分享,可在线阅读,更多相关《库存管理系统课程设计.doc(8页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、【精品文档】如有侵权,请联系网站删除,仅供学习与交流库存管理系统课程设计.精品文档.Oracle课程设计报告设计题目:库存管理系统姓 名:XXXXX 班 级:XXXX 学 号:XXXXX指导老师: XXXX 2011年11月1. 库存管理系统登录注册界面及代码Private Sub Command1_Click() Dim UserName As String Dim PassWord As String Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim StrSQL As String conn.Open P
2、rovider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Users尤远明Desktop库存管理库存.mdb UserName = Trim(Text1.Text) PassWord = Trim(Text2.Text)If UserName = Or PassWord = Then MsgBox 对不起,用户或密码不能为空!请重新输入!, vbCritical, 错误 ElseIf UserName Empty And PassWord Empty Then StrSQL = select * from 用户 where 用户名= & UserName &
3、and 密码= & PassWord & rs.Open StrSQL, conn, adOpenKeyset, adLockPessimistic If rs.EOF = True Then MsgBox 对不起,无此用户或者密码不正确!请重新输入!, vbCritical, 错误 Text1.Text = Text2.Text = Text1.SetFocus rs.CloseElse 登陆成功,以下为权限验证Form4.ShowUnload MeEnd IfEnd IfEnd SubPrivate Sub Command2_Click() EndEnd SubPrivate Sub Co
4、mmand3_Click()Form8.ShowEnd Sub库存供应商信息添加修改删除界面及代码Private Sub Command1_Click()Adodc1.Recordset.AddNewAdodc1.Recordset.Fields(用户名) = Text1.TextAdodc1.Recordset.Fields(密码) = Text2.TextAdodc1.Recordset.UpdateEnd SubPrivate Sub Command2_Click()Me.HideForm1.ShowEnd SubPrivate Sub Command1_Click()If Comman
5、d1.Caption = 添加 Then Command1.Caption = 更新 Data1.Recordset.AddNew Text1 = Text2 = Text3 = Text4 = Text5 = Text6.Text = CStr(Now() Text1.SetFocusElseText6.Text = CStr(Now() Command1.Caption = 添加 Data1.Recordset(货品号) = Text1 Data1.Recordset(货品名) = Text2 Data1.Recordset(供应商) = Text3 Data1.Recordset(单价)
6、 = Text4 Data1.Recordset(数量) = Text5 Data1.Recordset(时间) = Text6 Data1.Recordset.UpdateEnd IfEnd SubPrivate Sub Command2_Click() Data1.Recordset.Edit Data1.Recordset(货品号) = Text1 Data1.Recordset(货品名) = Text2 Data1.Recordset(供应商) = Text3 Data1.Recordset(单价) = Text4 Data1.Recordset(数量) = Text5 Data1.R
7、ecordset(时间) = Text6 Data1.Recordset.UpdateEnd SubPrivate Sub Command3_Click()If MsgBox(你确定要删除 & Text2.Text & 的信息吗?, vbOKCancel + vbDefaultButton2) = vbOK Then Data1.Recordset.Delete Data1.Recordset.MoveNextEnd IfEnd SubPrivate Sub command4_Click() Me.Hide Form4.ShowEnd SubPrivate Sub Form_Load()Tex
8、t6.Text = CStr(Now()End SubPrivate Sub Command1_Click()If command1.Caption = 添加 Then command1.Caption = 更新 Data1.Recordset.AddNew Text1 = Text2 = Text3 = Text4 = Text5 = Text1.SetFocusElse command1.Caption = 添加 Data1.Recordset(供应商编号) = Text1 Data1.Recordset(供应商名称) = Text2 Data1.Recordset(业务联系人) = Te
9、xt3 Data1.Recordset(联系电话) = Text4 Data1.Recordset(传真) = Text5 Data1.Recordset.UpdateEnd IfEnd SubPrivate Sub Command2_Click()If MsgBox(你确定要删除 & Text1.Text & 的信息吗?, vbOKCancel + vbDefaultButton2) = vbOK Then Data1.Recordset.Delete Data1.Recordset.MoveNextEnd IfEnd SubPrivate Sub Cmd_command3_Click()
10、Data1.Recordset.Edit Data1.Recordset(供应商编号) = Text1 Data1.Recordset(供应商名称) = Text2 Data1.Recordset(业务联系人) = Text3 Data1.Recordset(联系电话) = Text4 Data1.Recordset(传真) = Text5 Data1.Recordset.UpdateEnd SubPrivate Sub command4_Click() Me.Hide Form4.ShowEnd Sub2. 删除/修改要先进行查询需要的信息功能图及代码如下Private Sub Comman
11、d1_Click()If Text1.Text Then Form2.Data1.Recordset.MoveFirst Form2.Data1.Recordset.FindFirst (货品名= & & Text1 & ) If Form2.Data1.Recordset.NoMatch Then MsgBox (没有匹配的记录,请重新输入) Text1.SetFocus Else Form2.Text1 = Form2.Data1.Recordset(货品号) Form2.Text2 = Form2.Data1.Recordset(货品名) Form2.Text3 = Form2.Data
12、1.Recordset(供应商) Form2.Text4 = Form2.Data1.Recordset(单价) Form2.Text5 = Form2.Data1.Recordset(数量) Form3.Hide Form2.Show End IfElseIf Text2.Text Then Form2.Data1.Recordset.MoveFirst Form2.Data1.Recordset.FindFirst (供应商= & & Text2 & ) If Form2.Data1.Recordset.NoMatch Then MsgBox (没有匹配的记录,请重新输入) Text2.S
13、etFocus Else Form2.Text1 = Form2.Data1.Recordset(货品号) Form2.Text2 = Form2.Data1.Recordset(货品名) Form2.Text3 = Form2.Data1.Recordset(供应商) Form2.Text4 = Form2.Data1.Recordset(单价) Form2.Text5 = Form2.Data1.Recordset(数量) Form3.Hide Form2.Show End If ElseIf Text3.Text Then Form2.Data1.Recordset.MoveFirst
14、Form2.Data1.Recordset.FindFirst (货品号= & & Text3 & ) If Form2.Data1.Recordset.NoMatch Then MsgBox (没有匹配的记录,请重新输入) Text3.SetFocus Else Form2.Text1 = Form2.Data1.Recordset(货品号) Form2.Text2 = Form2.Data1.Recordset(货品名) Form2.Text3 = Form2.Data1.Recordset(供应商) Form2.Text4 = Form2.Data1.Recordset(单价) Form
15、2.Text5 = Form2.Data1.Recordset(数量) Form3.Hide Form2.Show End If Else MsgBox (你至少选择一种查询方式) End IfEnd SubPrivate Sub Command2_Click()Me.HideForm4.ShowEnd Sub3. 查询库存供应商信息功能图及代码Private Sub Command1_Click()Me.HideForm4.ShowEnd SubPrivate Sub Command2_Click()Dim StrSQL As StringIf Text1.Text Then Adodc1.
16、Recordset.Close If Val(Text1.Text) 0 Then StrSQL = select * from 库存 where 货品号= & Trim(Text1.Text) & Else StrSQL = select * from 库存 where 货品名= & Trim(Text1.Text) & End If Adodc1.CommandType = adCmdText Adodc1.Recordset.Open StrSQL Set DataGrid1.DataSource = Adodc1 Else Set DataGrid1.DataSource = Noth
17、ing End IfEnd SubPrivate Sub Command1_Click()Me.HideForm4.ShowEnd SubPrivate Sub Command2_Click()Dim StrSQL As StringIf Text1.Text Then Adodc1.Recordset.Close If Val(Text1.Text) 0 Then StrSQL = select * from 供应商 where 供应商编号= & Trim(Text1.Text) & Else StrSQL = select * from 供应商 where 供应商名称= & Trim(Text1.Text) & End If Adodc1.CommandType = adCmdText Adodc1.Recordset.Open StrSQL Set DataGrid1.DataSource = Adodc1 Else Set DataGrid1.DataSource = Nothing End If End Sub
限制150内