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

📄 frm_busline.frm

📁 vb+sql (sql server 2000)
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frm_busline 
   Caption         =   "线路信息管理"
   ClientHeight    =   4740
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   11955
   LinkTopic       =   "Form1"
   ScaleHeight     =   4740
   ScaleWidth      =   11955
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame1 
      Height          =   975
      Left            =   1440
      TabIndex        =   1
      Top             =   3360
      Width           =   9135
      Begin VB.CommandButton fault 
         Caption         =   "退出"
         Height          =   375
         Left            =   7320
         TabIndex        =   6
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton cmd_que 
         Caption         =   "查询"
         Height          =   375
         Left            =   5520
         TabIndex        =   5
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton cmd_del 
         Caption         =   "删除"
         Height          =   375
         Left            =   3840
         TabIndex        =   4
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton cmd_edit 
         Caption         =   "修改"
         Height          =   375
         Left            =   2160
         TabIndex        =   3
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton cmd_add 
         Caption         =   "添加"
         Height          =   375
         Left            =   480
         TabIndex        =   2
         Top             =   360
         Width           =   1335
      End
   End
   Begin MSFlexGridLib.MSFlexGrid FGridDatatable 
      Height          =   2895
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   11415
      _ExtentX        =   20135
      _ExtentY        =   5106
      _Version        =   393216
      Rows            =   1
      Cols            =   0
      FixedRows       =   0
      FixedCols       =   0
      AllowBigSelection=   0   'False
      FillStyle       =   1
      SelectionMode   =   1
   End
End
Attribute VB_Name = "frm_busline"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Sub ShowTitle()
    Dim i As Integer
    
    With FGridDatatable
        '设置表头文字
        .Cols = 10
        .TextMatrix(0, 1) = "线路编号"
        .TextMatrix(0, 2) = "起始城市"
        .TextMatrix(0, 3) = "到达城市"
        .TextMatrix(0, 4) = "起始日期"
        .TextMatrix(0, 5) = "起始时间"
        .TextMatrix(0, 6) = "到达时间"
        .TextMatrix(0, 7) = "汽车编号"
        .TextMatrix(0, 8) = "车票价格"
        .TextMatrix(0, 9) = "备注"
        
 
        
        '设置单元大小
        .ColWidth(0) = 200
        .ColWidth(1) = 1000
        .ColWidth(2) = 1000
        .ColWidth(3) = 1000
        .ColWidth(4) = 1000
        .ColWidth(5) = 1500
        .ColWidth(6) = 1500
        .ColWidth(7) = 1500
        .ColWidth(8) = 1500
        .ColWidth(9) = 1500
        
    End With
End Sub

Private Sub cmd_add_Click()
frm_addlineinfo.Show
End Sub

Private Sub cmd_del_Click()
Dim SelectedRowIndex As Integer
Dim strSQL As String
    SelectedRowIndex = FGridDatatable.Row
    CurrentLine = FGridDatatable.TextMatrix(SelectedRowIndex, 1)
    If MsgBox("真的要删除此条记录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
        OpenDB
        strSQL = "delete from buslineinfo where buslineno ='" + CurrentLine + "'"
        objConn.Execute (strSQL)
        CloseDB
        MsgBox "记录已删除", vbOKOnly
        frm_busline.FGridDatatable.Clear
        frm_busline.ShowTitle
        frm_busline.loadData ("")
    End If
End Sub

Private Sub cmd_edit_Click()

Dim SelectedRowIndex As Integer
    SelectedRowIndex = FGridDatatable.Row
    CurrentLine = FGridDatatable.TextMatrix(SelectedRowIndex, 1)
    frm_editlineinfo.Show 1
End Sub

Private Sub cmd_que_Click()
frm_quelineinfo.Show
End Sub

Private Sub fault_Click()
Unload Me

End Sub

Private Sub Form_Load()
    ShowTitle
    loadData ("")
End Sub
Public Sub loadData(InputSQL As String)
Dim strSQL As String
Dim i As Integer


If InputSQL = "" Then
  strSQL = "Select * from buslineinfo"
Else
  strSQL = InputSQL
End If
FGridDatatable.Rows = 1
  OpenDB
    
    objRS.Open strSQL, objConn, adOpenKeyset, adLockOptimistic
    If Not objRS.EOF Then
        For i = 1 To objRS.RecordCount
        
        FGridDatatable.Rows = FGridDatatable.Rows + 1
         
        FGridDatatable.TextMatrix(i, 1) = objRS.Fields(0).Value
        
        FGridDatatable.TextMatrix(i, 2) = objRS.Fields(1).Value
        
        FGridDatatable.TextMatrix(i, 3) = objRS.Fields(2).Value
        
        FGridDatatable.TextMatrix(i, 4) = objRS.Fields(3).Value
        
        FGridDatatable.TextMatrix(i, 5) = objRS.Fields(4).Value
        
        FGridDatatable.TextMatrix(i, 6) = objRS.Fields(5).Value
        
        FGridDatatable.TextMatrix(i, 7) = objRS.Fields(6).Value
        
        FGridDatatable.TextMatrix(i, 8) = objRS.Fields(7).Value
       
        FGridDatatable.TextMatrix(i, 9) = objRS.Fields(8).Value
        
        
        cmd_edit.Enabled = True
        cmd_del.Enabled = True
        If Not objRS.EOF Then
            objRS.MoveNext
        End If
        Next i
        FGridDatatable.Row = 0
        FGridDatatable.Col = 0
        FGridDatatable.RowSel = FGridDatatable.Rows - 1
        FGridDatatable.ColSel = FGridDatatable.Cols - 1
        FGridDatatable.CellAlignment = 2
        FGridDatatable.Row = FGridDatatable.Rows - 1
        cmd_del.Enabled = True
        cmd_edit.Enabled = True
        
    Else
        cmd_edit.Enabled = False
        cmd_del.Enabled = False
    End If
    objRS.Close
    CloseDB

End Sub

⌨️ 快捷键说明

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