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

📄

📁 这是一个用vb+SQL Server数据库编写的样品检验代码。包括样品的购买库存以及检验的各项程序
💻
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form 周期表 
   Caption         =   "周期表"
   ClientHeight    =   7440
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   10650
   Icon            =   "周期表.frx":0000
   LinkTopic       =   "Form2"
   ScaleHeight     =   7440
   ScaleWidth      =   10650
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame FrmYPXXB 
      Caption         =   "周期表"
      Height          =   1815
      Left            =   2400
      TabIndex        =   14
      Top             =   120
      Width           =   4215
      Begin VB.TextBox TxtBZ 
         DataField       =   "备注"
         DataSource      =   "Adodc1"
         Height          =   270
         Left            =   1200
         Locked          =   -1  'True
         TabIndex        =   10
         Text            =   "TxtBZ"
         Top             =   1440
         Width           =   2895
      End
      Begin VB.TextBox TxtYY 
         DataField       =   "意义"
         DataSource      =   "Adodc1"
         Height          =   270
         Left            =   1200
         Locked          =   -1  'True
         TabIndex        =   9
         Text            =   "TxtYY"
         Top             =   1080
         Width           =   2895
      End
      Begin VB.TextBox TxtCXZ 
         DataField       =   "抽象值"
         DataSource      =   "Adodc1"
         Height          =   270
         Left            =   1200
         Locked          =   -1  'True
         TabIndex        =   8
         Text            =   "TxtCXZ"
         Top             =   720
         Width           =   2895
      End
      Begin VB.TextBox TxtZQ 
         DataField       =   "周期"
         DataSource      =   "Adodc1"
         Height          =   270
         Left            =   1200
         Locked          =   -1  'True
         TabIndex        =   7
         Text            =   "TxtZQ"
         Top             =   360
         Width           =   2895
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "周期"
         Height          =   180
         Left            =   240
         TabIndex        =   18
         Top             =   360
         Width           =   360
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "抽象值"
         Height          =   180
         Left            =   240
         TabIndex        =   17
         Top             =   720
         Width           =   540
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "意义"
         Height          =   180
         Left            =   240
         TabIndex        =   16
         Top             =   1080
         Width           =   360
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "备注"
         Height          =   180
         Left            =   240
         TabIndex        =   15
         Top             =   1440
         Width           =   360
      End
   End
   Begin VB.CommandButton cmdsave 
      Appearance      =   0  'Flat
      Caption         =   "保存"
      Height          =   375
      Left            =   8520
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1560
      Width           =   855
   End
   Begin VB.CommandButton cmdadd 
      Appearance      =   0  'Flat
      Caption         =   "添加"
      Height          =   375
      Left            =   8520
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   360
      Width           =   855
   End
   Begin VB.CommandButton cmddelete 
      Appearance      =   0  'Flat
      Caption         =   "删除"
      Height          =   375
      Left            =   9480
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   1560
      Width           =   855
   End
   Begin VB.CommandButton cmdcancel 
      Appearance      =   0  'Flat
      Caption         =   "取消"
      Enabled         =   0   'False
      Height          =   375
      Left            =   9480
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   360
      Width           =   855
   End
   Begin VB.CommandButton cmdedit 
      Appearance      =   0  'Flat
      Caption         =   "编辑"
      Height          =   375
      Left            =   8520
      MaskColor       =   &H00FFFFFF&
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   960
      Width           =   855
   End
   Begin VB.CommandButton cmdexitedit 
      Appearance      =   0  'Flat
      Caption         =   "退出编辑"
      Enabled         =   0   'False
      Height          =   375
      Left            =   9480
      MaskColor       =   &H0000FF00&
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   960
      Width           =   855
   End
   Begin VB.Frame Frame_sort 
      Caption         =   "排序"
      Height          =   1335
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   1935
      Begin VB.CommandButton cmdsort 
         Caption         =   "开始排序"
         Height          =   375
         Left            =   360
         TabIndex        =   12
         Top             =   840
         Width           =   1215
      End
      Begin VB.ComboBox Combosort 
         Height          =   300
         ItemData        =   "周期表.frx":08CA
         Left            =   360
         List            =   "周期表.frx":08D4
         TabIndex        =   11
         Text            =   "周期"
         Top             =   360
         Width           =   1215
      End
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   13
      Top             =   7065
      Width           =   10650
      _ExtentX        =   18785
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   3
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "周期表.frx":08E6
      Height          =   4935
      Left            =   240
      TabIndex        =   19
      Top             =   2040
      Width           =   10215
      _ExtentX        =   18018
      _ExtentY        =   8705
      _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       =   "周期"
         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       =   "抽象值"
         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       =   "意义"
         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       =   "备注"
         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     =   1275.024
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   1454.74
         EndProperty
         BeginProperty Column02 
            ColumnWidth     =   5580.284
         EndProperty
         BeginProperty Column03 
         EndProperty
      EndProperty
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   240
      Top             =   1560
      Width           =   1935
      _ExtentX        =   3413
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   3
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "DSN=样品检测项目系统"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "样品检测项目系统"
      OtherAttributes =   ""
      UserName        =   "sa"
      Password        =   ""
      RecordSource    =   "select * from 周期表"
      Caption         =   "周期表"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
End
Attribute VB_Name = "周期表"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdadd_Click()
TxtZQ.Locked = False
TxtCXZ.Locked = False
TxtYY.Locked = False
TxtBZ.Locked = False


 Adodc1.Recordset.AddNew
 cmdcancel.Enabled = True
 cmdsave.Enabled = True
 cmdadd.Enabled = False
 cmddelete.Enabled = False
 cmdedit.Enabled = False
 

End Sub

Private Sub cmdcancel_Click()
Adodc1.Recordset.CancelBatch

Adodc1.RecordSource = "select * from 周期表" 'order by 上传时间 desc"
Adodc1.Refresh

cmdcancel.Enabled = False
cmdsave.Enabled = False
cmdadd.Enabled = True
cmddelete.Enabled = True
cmdedit.Enabled = True


TxtZQ.Locked = True
TxtCXZ.Locked = True
TxtYY.Locked = True
TxtBZ.Locked = True



End Sub

Private Sub cmddelete_Click()
X = MsgBox("要删除当前记录吗?", 49, "资料更正")
 '如果删除记录集的最后一条记录
  '记录或记录集中唯一的记录
  If X = 1 Then
  Adodc1.Recordset.Delete
  Adodc1.Recordset.MoveNext
  End If
  If X = 2 Then
  End If
  
  
Adodc1.Refresh
  

End Sub

Private Sub cmdedit_Click()
TxtZQ.Locked = False
TxtCXZ.Locked = False
TxtYY.Locked = False
TxtBZ.Locked = False


cmdexitedit.Enabled = True
cmdsave.Enabled = True

cmdadd.Enabled = False
cmdcancel.Enabled = False
cmddelete.Enabled = False
cmdedit.Enabled = False

End Sub


Private Sub cmdexitedit_Click()

TxtZQ.Locked = True
TxtCXZ.Locked = True
TxtYY.Locked = True
TxtBZ.Locked = True


cmdadd.Enabled = True
cmddelete.Enabled = True
cmdexitedit.Enabled = False
cmdsave.Enabled = False
cmdedit.Enabled = True



StatusBar1.Panels(1).Text = "记录总数:" + CStr(Adodc1.Recordset.RecordCount)
StatusBar1.Panels(2).Text = "当前记录号:" + CStr(Adodc1.Recordset.AbsolutePosition)

End Sub


Private Sub cmdsave_Click()
If TxtZQ.Text = "" Then
    MsgBox "周期 不能为空!", vbOKOnly + vbInformation, "错误"
    TxtZQ.SetFocus
ElseIf TxtCXZ.Text = "" Then
    MsgBox "抽象值 不能为空!", vbOKOnly + vbInformation, "错误"
    TxtCXZ.SetFocus
ElseIf TxtYY.Text = "" Then
    MsgBox "意义 不能为空!", vbOKOnly + vbInformation, "错误"
    TxtYY.SetFocus


    
    
Else
    Adodc1.Recordset!周期 = Trim(TxtZQ.Text)
    Adodc1.Recordset!抽象值 = Trim(TxtCXZ.Text)
    Adodc1.Recordset!意义 = Trim(TxtYY.Text)
    Adodc1.Recordset!备注 = Trim(TxtBZ.Text)

    Adodc1.Recordset.Update

    MsgBox "资料修改成功!", vbOKOnly + vbInformation, "修改成功"



    cmdadd.Enabled = True
    cmddelete.Enabled = True
    cmdedit.Enabled = True
    cmdexitedit.Enabled = False
    cmdcancel.Enabled = False

    Adodc1.Refresh


    cmdsave.Enabled = False
    

TxtZQ.Locked = True
TxtCXZ.Locked = True
TxtYY.Locked = True
TxtBZ.Locked = True


End If

End Sub


⌨️ 快捷键说明

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