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

📄 frmph.frm

📁 这个是VB环境开发的,我也是转载的把原来的Access数据库改成了SQl Server数据库.希望大家可以借鉴
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmph 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "库存查询"
   ClientHeight    =   4905
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7590
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4905
   ScaleWidth      =   7590
   ShowInTaskbar   =   0   'False
   Begin MSDataGridLib.DataGrid dtgrd2 
      Height          =   3492
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   7548
      _ExtentX        =   13309
      _ExtentY        =   6165
      _Version        =   393216
      AllowUpdate     =   0   'False
      HeadLines       =   1
      RowHeight       =   15
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   4
      BeginProperty Column00 
         DataField       =   "EName"
         Caption         =   "元器件名称"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "Estandard"
         Caption         =   "元器件规格"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "EType"
         Caption         =   "元器件型号"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "EStock"
         Caption         =   "库存量"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
            ColumnWidth     =   1950.236
         EndProperty
         BeginProperty Column01 
            ColumnAllowSizing=   0   'False
            Locked          =   -1  'True
            Object.Visible         =   0   'False
            ColumnWidth     =   1049.953
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   3149.858
         EndProperty
         BeginProperty Column03 
            ColumnWidth     =   1649.764
         EndProperty
      EndProperty
   End
   Begin VB.PictureBox pic 
      Align           =   2  'Align Bottom
      BorderStyle     =   0  'None
      Height          =   396
      Left            =   0
      ScaleHeight     =   390
      ScaleWidth      =   7590
      TabIndex        =   6
      Top             =   4200
      Width           =   7584
      Begin VB.TextBox txtname 
         Height          =   270
         Left            =   1920
         TabIndex        =   10
         Top             =   0
         Width           =   1695
      End
      Begin VB.CommandButton cmdClose 
         Caption         =   "关闭"
         Height          =   330
         Left            =   6600
         TabIndex        =   9
         Top             =   0
         Width           =   855
      End
      Begin VB.CommandButton cmdPrint 
         Caption         =   "打印"
         Height          =   330
         Left            =   6840
         TabIndex        =   8
         Top             =   0
         Width           =   612
      End
      Begin VB.CommandButton cmdOK 
         Caption         =   "查看"
         Default         =   -1  'True
         Height          =   330
         Left            =   5280
         TabIndex        =   7
         Top             =   0
         Width           =   855
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "名 称:"
         Height          =   180
         Left            =   1200
         TabIndex        =   11
         Top             =   0
         Width           =   630
      End
   End
   Begin MSDataGridLib.DataGrid dtgrd1 
      Height          =   3492
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Visible         =   0   'False
      Width           =   7572
      _ExtentX        =   13361
      _ExtentY        =   6165
      _Version        =   393216
      AllowUpdate     =   0   'False
      Appearance      =   0
      HeadLines       =   1
      RowHeight       =   15
      FormatLocked    =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   4
      BeginProperty Column00 
         DataField       =   "PName"
         Caption         =   "产品名称"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   "Pstardard"
         Caption         =   "规格"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column02 
         DataField       =   "PType"
         Caption         =   "型号"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column03 
         DataField       =   "Pstock"
         Caption         =   "库存量"
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
            Object.Visible         =   0   'False
            ColumnWidth     =   1110.047
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   1964.976
         EndProperty
         BeginProperty Column03 
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.StatusBar sbr 
      Align           =   2  'Align Bottom
      Height          =   312
      Left            =   0
      TabIndex        =   2
      Top             =   4584
      Width           =   7584
      _ExtentX        =   13388
      _ExtentY        =   556
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   4
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   6
            Alignment       =   1
            TextSave        =   "2003-04-08"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   5
            Alignment       =   1
            TextSave        =   "14:57"
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   14111
            MinWidth        =   14111
            Text            =   "可以通过拖动调整字段宽度。"
            TextSave        =   "可以通过拖动调整字段宽度。"
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Frame Frame1 
      Height          =   615
      Left            =   1200
      TabIndex        =   3
      Top             =   3480
      Width           =   4815
      Begin VB.OptionButton opt1 
         Caption         =   "元件库存"
         Height          =   255
         Left            =   960
         TabIndex        =   4
         Top             =   240
         Value           =   -1  'True
         Width           =   1215
      End
      Begin VB.OptionButton opt2 
         Caption         =   "成品库存"
         Height          =   255
         Left            =   2640
         TabIndex        =   5
         Top             =   240
         Width           =   1095
      End
   End
End
Attribute VB_Name = "frmph"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim RsP As New Recordset
Dim RsE As New Recordset

Private Sub cmdClose_Click()
    Unload Me
End Sub

Private Sub CmdOk_Click()
On Error GoTo gl
      Dim SQL As String
      If opt1.Value Then
        If Trim(txtname) <> "" Then
          SQL = "ename like '%" & Trim(txtname) & "%'"
      End If
           RsE.Filter = SQL
           If Not (RsE.BOF Or RsE.EOF) Then
            Set dtgrd2.DataSource = RsE
           Else
            MsgBox "没有找到记录!", , ginfo
            RsE.Filter = ""
           End If
      Else
           If Trim(txtname) <> "" Then
             SQL = "Pname='" & Trim(txtname) & "'"
           End If
           RsP.Filter = SQL
           If Not (RsP.BOF Or RsP.EOF) Then
               Set dtgrd1.DataSource = RsP
            Else
              MsgBox " 没有找到记录!", , ginfo
              RsP.Filter = ""
           End If
      End If
     Exit Sub
gl:     MsgBox err.Description
End Sub



Private Sub Form_Load()
    frmph.Top = 0
    frmph.Left = 0
    RsP.Open "select * FROM prostock", cn, adOpenKeyset, adLockBatchOptimistic
    RsE.Open "select * from EleStock", cn, adOpenKeyset, adLockBatchOptimistic
End Sub

Private Sub Form_Unload(Cancel As Integer)
    RsP.Close
    RsE.Close
End Sub

Private Sub opt1_Click()
    If opt1.Value Then
        dtgrd1.Visible = False
        dtgrd2.Visible = True
    End If
End Sub

Private Sub opt2_Click()
  If opt2.Value = True Then
    dtgrd1.Visible = True
    dtgrd2.Visible = False
  End If
End Sub

⌨️ 快捷键说明

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