VB+SQL server机票预定系统 第10页

VB+SQL server机票预定系统 第10页

    '固定表头

        .FixedRows = 1

               

        '设置各列的对齐方式

        For i = 0 To 6

            .ColAlignment(i) = 0

        Next i

          '表头项居中

        .FillStyle = flexFillRepeat

        .Col = 0

        .Row = 0

        .RowSel = 1

        .ColSel = .Cols - 1

        .CellAlignment = 4

                '设置单元大小

        .ColWidth(0) = 1000

        .ColWidth(1) = 1000

        .ColWidth(2) = 1000

        .ColWidth(3) = 1000

        .ColWidth(4) = 2000

        .ColWidth(5) = 1000

        .ColWidth(6) = 3000

                .Row = 1

            End With

End Sub

Private Sub msgList_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

    '右键弹出

    If Button = 2 And Shift = 0 Then

           End If

    End Sub

添加用户信息:

若图片无法显示请联系QQ3249114,本论文免费,转发请注明源于www.751com.cn

6.4添加用户信息界面

代码如下:Option Explicit

'是否改动过记录,ture为改过

Dim mblChange As Boolean

Dim mrc As ADODB.Recordset

Public txtSQL As String

Private Sub cmdExit_Click()

    If mblChange And cmdSave.Enabled Then

        If MsgBox("保存当前记录的变化吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then

            '保存

            Call cmdSave_Click

        End If

    End If

    Unload Me

End Sub

Private Sub cmdSave_Click()

    Dim intCount As Integer

    Dim sMeg As String

    Dim MsgText As String

        For intCount = 0 To 2

        If Trim(txtItem(intCount) & " ") = "" Then

            Select Case intCount

                Case 0

                    sMeg = "旅客姓名"

                Case 1

                    sMeg = "身份证号码"

                Case 2

                    sMeg = "联系电话"

            End Select

            sMeg = sMeg & "不能为空!"

            MsgBox sMeg, vbOKOnly + vbExclamation, "警告"

            txtItem(intCount).SetFocus

            Exit Sub

        End If

    Next intCount

       For intCount = 0 To 1

        If Trim(Combo1(intCount) & " ") = "" Then

            Select Case intCount

                Case 0

                    sMeg = "起飞时间"

                Case 1

                    sMeg = "目的地"

            End Select

            sMeg = sMeg & "不能为空!"

            MsgBox sMeg, vbOKOnly + vbExclamation, "警告"

            Combo1(intCount).SetFocus

            Exit Sub

        End If

    Next intCount

      '判断是否有相同内容的记录

    txtSQL = "select * from customerInfo where customerNO<>'" & Trim(txtNo) & "' and customerName='" & Trim(txtItem(0)) & "'"

    Set mrc = ExecuteSQL(txtSQL, MsgText)

    If mrc.EOF = False Then

        MsgBox "已经存在相同客户的记录!", vbOKOnly + vbExclamation, "警告"

        txtItem(0).SetFocus

        Exit Sub

    End If

       '先删除已有记录

    txtSQL = "delete from customerInfo where customerNO='" & Trim(txtNo) & "'"

    Set mrc = ExecuteSQL(txtSQL, MsgText)

       '再加入新记录

    txtSQL = "select * from customerInfo"

    Set mrc = ExecuteSQL(txtSQL, MsgText)

    mrc.AddNew

        mrc.Fields(0) = Trim(txtNo)

    mrc.Fields(1) = Trim(txtItem(0))

    mrc.Fields(2) = Trim(Combo1(0))

    For intCount = 1 To 2

        mrc.Fields(intCount + 2) = Trim(txtItem(intCount))

    Next intCount

        mrc.Fields(5) = Trim(Combo1(1))

    mrc.Fields(6) = Trim(txtItem(3))

    mrc.Update

    mrc.Close

        If gintCmode = 1 Then

        MsgBox "添加记录成功!", vbOKOnly + vbExclamation, "添加记录"

        For intCount = 0 To 3

            txtItem(intCount) = ""

        Next intCount

               mblChange = False

        Unload frmCustomer

        frmCustomer.txtSQL = "select * from customerInfo"

        frmCustomer.Show

           ElseIf gintCmode = 2 Then

        Unload Me

        Unload frmCustomer

                frmCustomer.txtSQL = "select * from customerInfo"

        frmCustomer.Show

    End If

End Sub

Private Sub Form_Load()

    Dim intCount As Integer

    Dim MsgText As String

    Dim i As Integer

    Dim mrcc As ADODB.Recordset

  If gintCmode = 1 Then

        Me.Caption = Me.Caption & "添加"

        'txtNo = GetRkno()

   ElseIf gintCmode = 2 Then

        Set mrc = ExecuteSQL(txtSQL, MsgText)

     If mrc.EOF = False Then

            With mrc

                'txtNo = .Fields(0)

                txtItem(0) = .Fields(1)

               For intCount = 1 To 2

                    txtItem(intCount) = .Fields(intCount + 2)

                Next intCount

            txtItem(3) = .Fields(6)

        End With

       End If

       Me.Caption = Me.Caption & "修改"

    End If

     For intCount = 0 To 1

        Combo1(intCount).Clear

    Next intCount

   Combo1(0).AddItem ""

    Combo1(0).AddItem ""

   txtSQL = "select DISTINCT ctypeName from customerType"

    Set mrcc = ExecuteSQL(txtSQL, MsgText)

    'If Not mrcc.EOF Then

       ' Do While Not mrcc.EOF

           ' Combo1(1).AddItem mrcc.Fields(0)

           ' mrcc.MoveNext

        'Loop

    'End If

   'mrcc.Close

    mblChange = False

End Sub

Private Sub Form_Unload(Cancel As Integer)

    gintCmode = 0

End Sub

Private Sub txtItem_Change(Index As Integer)

    '有变化设置gblchange

    mblChange = True

End Sub

Private Sub txtItem_GotFocus(Index As Integer)

    txtItem(Index).SelStart = 0

    txtItem(Index).SelLength = Len(txtItem(Index))

End Sub

Private Sub txtItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)

    EnterToTab KeyCode

End Sub

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有