⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form4.frm

📁 图书馆借书系统
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form4 
   Caption         =   "Form4"
   ClientHeight    =   6885
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9135
   LinkTopic       =   "Form4"
   ScaleHeight     =   6885
   ScaleWidth      =   9135
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox Picture1 
      Height          =   6735
      Left            =   0
      Picture         =   "Form4.frx":0000
      ScaleHeight     =   6675
      ScaleWidth      =   8835
      TabIndex        =   0
      Top             =   0
      Width           =   8895
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
         Height          =   3855
         Left            =   0
         TabIndex        =   12
         Top             =   2880
         Width           =   8895
         _ExtentX        =   15690
         _ExtentY        =   6800
         _Version        =   393216
      End
      Begin VB.Frame Frame1 
         Caption         =   "出入库商品查询"
         Height          =   2895
         Left            =   0
         TabIndex        =   1
         Top             =   0
         Width           =   8895
         Begin VB.CommandButton Command4 
            Caption         =   "退出"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   14.25
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   855
            Left            =   7440
            TabIndex        =   15
            Top             =   1320
            Width           =   1215
         End
         Begin VB.CommandButton Command3 
            Caption         =   "返回"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   14.25
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   855
            Left            =   6360
            TabIndex        =   14
            Top             =   1320
            Width           =   1095
         End
         Begin VB.CommandButton Command2 
            Caption         =   "入库商品查询"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   14.25
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   900
            Left            =   7440
            TabIndex        =   13
            Top             =   480
            Width           =   1215
         End
         Begin VB.CommandButton Command1 
            Caption         =   "出库商品查询"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   14.25
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   855
            Left            =   6360
            TabIndex        =   6
            Top             =   480
            Width           =   1095
         End
         Begin VB.ComboBox Combo1 
            Height          =   300
            ItemData        =   "Form4.frx":AE55
            Left            =   2880
            List            =   "Form4.frx":AE77
            TabIndex        =   5
            Top             =   480
            Width           =   1695
         End
         Begin VB.ComboBox Combo3 
            Height          =   300
            Left            =   960
            TabIndex        =   4
            Top             =   1440
            Width           =   1215
         End
         Begin VB.ComboBox Combo4 
            Height          =   300
            Left            =   3120
            TabIndex        =   3
            Top             =   1440
            Width           =   975
         End
         Begin VB.ComboBox Combo5 
            Height          =   300
            Left            =   5040
            TabIndex        =   2
            Top             =   1440
            Width           =   1095
         End
         Begin VB.Label Label6 
            Caption         =   "年"
            Height          =   255
            Left            =   120
            TabIndex        =   11
            Top             =   1440
            Width           =   375
         End
         Begin VB.Label Label5 
            Caption         =   "月"
            Height          =   375
            Left            =   2640
            TabIndex        =   10
            Top             =   1440
            Width           =   255
         End
         Begin VB.Label Label1 
            Caption         =   "商品名"
            Height          =   375
            Left            =   1920
            TabIndex        =   9
            Top             =   480
            Width           =   855
         End
         Begin VB.Label Label3 
            Caption         =   "日"
            Height          =   255
            Left            =   4440
            TabIndex        =   8
            Top             =   1440
            Width           =   255
         End
         Begin VB.Label Label4 
            Caption         =   "Label4"
            Height          =   15
            Left            =   2400
            TabIndex        =   7
            Top             =   1440
            Width           =   375
         End
      End
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a As String
Dim b As String
Dim c As String
Dim d As String
Dim e As String
Dim cnn1 As ADODB.Connection '连接
Dim mycommand As ADODB.Command '命令
Dim rstByQuery As ADODB.Recordset '结果集
Dim strCnn As String '连接字符串

Private Sub shdt(str)
Dim i As Integer
Dim j As Integer

Set parm = New ADODB.Parameter
Set mycommand = New ADODB.Command

' parm_jobid.Name = "name1" 'this line can be ommited
parm.Type = adChar '参数类型
parm.Size = 10 '参数长度
parm.Direction = adParamInput '参数方向,输入或输出
mycommand.Parameters.Append parm '加入参数
mycommand.ActiveConnection = cnn1 '指定该command 的当前活动连接
mycommand.CommandText = str
mycommand.CommandType = adCmdText '表明command 类型
Set rstByQuery = New ADODB.Recordset
Set rstByQuery = mycommand.Execute()
i = 0

Do While Not rstByQuery.EOF
i = i + 1 ' i 中保存记录个数
rstByQuery.MoveNext
Loop
MSFlexGrid1.Rows = i + 1 '动态设置MSFlexGrid的行和列
MSFlexGrid1.Cols = rstByQuery.Fields.Count + 1
MSFlexGrid1.Row = 0
For i = 0 To rstByQuery.Fields.Count - 1
MSFlexGrid1.Col = i + 1
MSFlexGrid1.Text = rstByQuery.Fields.Item(i).Name
Next '设置第一行的标题,用域名填充

i = 0
rstByQuery.Requery
Do While Not rstByQuery.EOF
i = i + 1
MSFlexGrid1.Row = i '确定行
For j = 0 To rstByQuery.Fields.Count - 1
MSFlexGrid1.Col = j + 1
MSFlexGrid1.Text = rstByQuery(j) '添充所有的列
Next
rstByQuery.MoveNext

Loop '这个循环用来填充MSFlexGrid的内容

End Sub

Private Sub Command1_Click()
a = Combo1.Text
c = Combo3.Text
d = Combo4.Text
e = Combo5.Text

If a <> "" And c <> "" And d <> "" And e <> "" Then
    shdt "select * from ckudanju where riqi=" + c + "-" + d + "-" + e + " and spming=" + "'" + a + "'"
ElseIf a <> "" And c = "" And d = "" And e = "" Then
    shdt "select * from ckudanju where spming=" + "'" + a + "'"
ElseIf a = "" And c <> "" And d <> "" And e <> "" Then
    shdt "select * from ckudanju where riqi=" + c + "-" + d + "-" + e
Else
      MsgBox "商品名或日期不能为空"
    Combo1.SetFocus
End If
End Sub

Private Sub Command2_Click()
a = Combo1.Text
c = Combo3.Text
d = Combo4.Text
e = Combo5.Text

If a <> "" And c <> "" And d <> "" And e <> "" Then
    shdt "select * from rkudanju where riqi=" + c + "-" + d + "-" + e + " and spming=" + "'" + a + "'"
ElseIf a <> "" And c = "" Or d = "" Or e = "" Then
    shdt "select * from rkudanju where spming=" + "'" + a + "'"
ElseIf a = "" And c <> "" And d <> "" And e <> "" Then
    shdt "select * from rkudanju where riqi=" + c + "-" + d + "-" + e
Else
      MsgBox "商品名及日期不能为空"
    Combo1.SetFocus
End If
End Sub

Private Sub Command3_Click()
Form3.Show
Unload Form4
End Sub

Private Sub Command4_Click()
End
End Sub

Private Sub Form_Load()

Set cnn1 = New ADODB.Connection '生成一个连接
strCnn = "FileDSN=DBtest.dsn;UID=DBUser;PWD=DBUser"
'没有系统数据源使用连接字符串

'strCnn = "DSN=mydsn;UID=sa;PWD=;"
'DATABASE=pubs;Driver={SQL Server};SERVER=gzl_pc" '
'如果系统数据源MYDSN指向PUBS数据库,也可以这样用
cnn1.Open strCnn, , , 0 '打开连接
End Sub

Private Sub Label2_Click()

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -