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

📄 frm_setline.frm

📁 提供给入门级别的GPRS编程人员
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Left            =   2400
         TabIndex        =   9
         Top             =   600
         Visible         =   0   'False
         Width           =   975
         _ExtentX        =   1720
         _ExtentY        =   661
         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
      End
      Begin VB.Label Label6 
         Caption         =   "线路名称:"
         Height          =   375
         Left            =   -74880
         TabIndex        =   16
         Top             =   1200
         Width           =   975
      End
      Begin VB.Label Label8 
         Caption         =   "线路名称:"
         Height          =   255
         Left            =   120
         TabIndex        =   15
         Top             =   1200
         Width           =   975
      End
      Begin VB.Label Label7 
         Caption         =   "线路编号:"
         Height          =   255
         Left            =   120
         TabIndex        =   14
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label5 
         Caption         =   "线路名称:"
         Height          =   255
         Left            =   -74880
         TabIndex        =   13
         Top             =   1200
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "线路编号:"
         Height          =   255
         Left            =   -74880
         TabIndex        =   12
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "线路名称:"
         Height          =   255
         Left            =   -74640
         TabIndex        =   11
         Top             =   1200
         Width           =   1335
      End
      Begin VB.Label Label2 
         Caption         =   "线路编号:"
         Height          =   255
         Left            =   -74880
         TabIndex        =   10
         Top             =   720
         Width           =   975
      End
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "设置线路"
      ForeColor       =   &H00FF0000&
      Height          =   255
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   855
   End
End
Attribute VB_Name = "frm_setline"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Form_Load()
   Dim i As Integer
   Dim strsql As String
   With MSHFlexGrid1
         For i = 0 To 2
              .ColWidth(i) = Me.MSHFlexGrid1.Width / 2
         Next i
    End With
    strsql = "select * from line"
    openrs strsql
    Set Me.MSHFlexGrid1.DataSource = rs
    clors
    With MSHFlexGrid1
             .TextMatrix(0, 0) = "线路编号"
             .TextMatrix(0, 1) = "线路名称"
    End With
End Sub

 

Private Sub xpcmdbutton1_Click() '添加
    Dim strsql As String
    If Trim(txt_id.Text) = "" Then
        MsgBox ("线路编号不能为空"), vbOKOnly + vbInformation, "提示"
        Exit Sub
    End If
    strsql = "select * from line"
    openrs strsql
    Do Until rs.EOF
       If rs.Fields("line_id").Value = txt_id.Text Then
           MsgBox ("已经存在该线路编号!"), vbOKOnly + vbInformation, "提示"
           clors
           Exit Sub
       End If
       rs.MoveNext
    Loop
    rs.AddNew
    rs.Fields("line_id").Value = txt_id.Text
    rs.Fields("line_name").Value = Trim(txt_name.Text)
    rs.UpdateBatch
    clors
    MsgBox ("线路添加成功!"), vbOKOnly + vbInformation, "提示"
    strsql = "select * from line"
    openrs strsql
    Set Me.MSHFlexGrid1.DataSource = rs
    clors
    With MSHFlexGrid1
             .TextMatrix(0, 0) = "线路编号"
             .TextMatrix(0, 1) = "线路名称"
    End With
End Sub

Private Sub xpcmdbutton2_Click() '修改
    Dim strsql As String
    If Trim(txt_idupdata.Text) = "" Then
        MsgBox ("线路编号不能为空"), vbOKOnly + vbInformation, "提示"
        Exit Sub
    End If
    strsql = "select * from line where line_id='" & Trim(txt_idupdata.Text) & "'"
    openrs strsql
    If rs.EOF Then
        MsgBox ("不存在该线路编号!"), vbOKOnly + vbInformation, "提示"
        clors
        Exit Sub
    End If
   
    rs.Delete
    rs.UpdateBatch
    strsql = "select * from line "
    openrs strsql
    Do Until rs.EOF
       If rs.Fields("line_id").Value = txt_idupdata.Text Then
           MsgBox ("已经存在该线路编号!"), vbOKOnly + vbInformation, "提示"
           clors
           Exit Sub
       End If
       rs.MoveNext
    Loop
    rs.AddNew
    rs.Fields("line_id").Value = txt_idupdata.Text
    rs.Fields("line_name").Value = Trim(txt_nameupdata.Text)
    rs.UpdateBatch
    clors
    MsgBox ("线路修该成功!"), vbOKOnly + vbInformation, "提示"
    strsql = "select * from line"
    openrs strsql
    Set Me.MSHFlexGrid1.DataSource = rs
    clors
    With MSHFlexGrid1
             .TextMatrix(0, 0) = "线路编号"
             .TextMatrix(0, 1) = "线路名称"
    End With
End Sub

Private Sub xpcmdbutton3_Click() '查询(修改)(此种做法可以修改线路编号)
    Dim strsql As String
    If Trim(txt_idupdata.Text) = "" Then
        MsgBox ("线路编号不能为空"), vbOKOnly + vbInformation, "提示"
        Exit Sub
    End If
    strsql = "select * from line where line_id='" & Trim(txt_idupdata.Text) & "'"
    openrs strsql
    If rs.EOF Then
        MsgBox ("不存在该线路编号!"), vbOKOnly + vbInformation, "提示"
        clors
        Exit Sub
    End If
    txt_nameupdata.Text = rs.Fields("line_name").Value
    clors
    strsql = "select * from line"
    openrs strsql
    Set Me.MSHFlexGrid1.DataSource = rs
    clors
    With MSHFlexGrid1
             .TextMatrix(0, 0) = "线路编号"
             .TextMatrix(0, 1) = "线路名称"
    End With
End Sub

Private Sub xpcmdbutton4_Click() '删除
    Dim strsql As String
    If Trim(txt_iddel.Text) = "" Then
        MsgBox ("线路编号不能为空"), vbOKOnly + vbInformation, "提示"
        Exit Sub
    End If
    strsql = "select * from line where line_id='" & Trim(txt_iddel.Text) & "'"
    openrs strsql
    If rs.EOF Then
        MsgBox ("不存在该线路编号!"), vbOKOnly + vbInformation, "提示"
        clors
        Exit Sub
    End If
   
    rs.Delete
    rs.UpdateBatch
    MsgBox ("线路已经成功删除"), vbOKOnly + vbInformation, "提示"
    strsql = "select * from line"
    openrs strsql
    Set Me.MSHFlexGrid1.DataSource = rs
    clors
    With MSHFlexGrid1
             .TextMatrix(0, 0) = "线路编号"
             .TextMatrix(0, 1) = "线路名称"
    End With
End Sub

Private Sub xpcmdbutton5_Click() '查询(删除)
    Dim strsql As String
    If Trim(txt_iddel.Text) = "" Then
        MsgBox ("线路编号不能为空"), vbOKOnly + vbInformation, "提示"
        Exit Sub
    End If
    strsql = "select * from line where line_id='" & Trim(txt_iddel.Text) & "'"
    openrs strsql
    If rs.EOF Then
        MsgBox ("不存在该线路编号!"), vbOKOnly + vbInformation, "提示"
        clors
        Exit Sub
    End If
    txt_namedel.Text = rs.Fields("line_name").Value
    clors
    strsql = "select * from line"
    openrs strsql
    Set Me.MSHFlexGrid1.DataSource = rs
    clors
    With MSHFlexGrid1
             .TextMatrix(0, 0) = "线路编号"
             .TextMatrix(0, 1) = "线路名称"
    End With
End Sub

Private Sub xpcmdbutton6_Click() '查询(舔加)
    Dim strsql As String
    If Trim(txt_id.Text) = "" Then
        MsgBox ("线路编号不能为空"), vbOKOnly + vbInformation, "提示"
        Exit Sub
    End If
    strsql = "select * from line where line_id='" & Trim(txt_id.Text) & "'"
    openrs strsql
    If rs.EOF Then
        MsgBox ("不存在该线路编号!"), vbOKOnly + vbInformation, "提示"
        clors
        Exit Sub
    End If
    txt_name.Text = rs.Fields("line_name").Value
    clors
    
    strsql = "select * from line"
    openrs strsql
    Set Me.MSHFlexGrid1.DataSource = rs
    clors
    With MSHFlexGrid1
             .TextMatrix(0, 0) = "线路编号"
             .TextMatrix(0, 1) = "线路名称"
    End With
End Sub

⌨️ 快捷键说明

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