SQL+VB图书管理系统(数据库+源代码+论文) 第14页

SQL+VB图书管理系统(数据库+源代码+论文) 第14页
Case "图书ID"
      If Txt_cxnr.Text = "" Then
        MsgBox "请输入图书ID!", vbCritical + vbOKCancel, "提示"
        Txt_cxnr.SetFocus
        Exit Sub
       Else
        sql = "select * from 图书信息 where 图书ID like '%" + Trim(Txt_cxnr.Text) + "%'"
        Txt_cxnr.SetFocus
      End If
    Case "图书名称"
      If Txt_cxnr.Text = "" Then
        MsgBox "请输入图书名称!", vbCritical + vbOKCancel, "提示"
        Txt_cxnr.SetFocus
        Exit Sub
       Else
        sql = "select * from 图书信息 where 图书名称 like '%" + Trim(Txt_cxnr.Text) + "%'"
        Txt_cxnr.SetFocus
       End If
    Case "图书类型"
      If Txt_cxnr.Text = "" Then
        MsgBox "请单击按钮选择图书类型!", vbCritical + vbOKCancel, "提示"
        Txt_cxnr.SetFocus
        Exit Sub
       Else
       sql = "select * from 图书信息 where 图书类型='" + Trim(Txt_cxnr.Text) + "'"
       Txt_cxnr.SetFocus
      End If
    Case "所有图书信息"
       sql = "select * from 图书信息"
     
  End Select
  ShowData sql, Me.MSFlexGrid1
  Me.StatusBar1.Panels(1).Text = "总共有" & Me.MSFlexGrid1.Rows - 1 & "条记录"
 
  If Frm_tscx.MSFlexGrid1.Rows <= 1 Then
   MsgBox "对不起!没有找到符合条件的记录!请重新输入查询内容!", vbOKCancel + vbInformation, "提示"
   Txt_cxnr.Text = ""
   Txt_cxnr.SetFocus
  Exit Sub
  End If
 
 
End Sub

Private Sub Form_Load()
Label2.Visible = False
  Txt_cxnr.Visible = False
  Command1.Visible = False
  Me.MSFlexGrid1.ColAlignment(0) = flexAlignCenterCenter
 Me.MSFlexGrid1.ColWidth(0) = 1800
 Me.MSFlexGrid1.ColWidth(1) = 1000
 'Me.MSFlexGrid1.ColWidth(2) = 4500
 
End Sub

 

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
  Case 3
  MoveFirst Me.MSFlexGrid1
   Me.StatusBar1.Panels(1).Text = "总共有" & Me.MSFlexGrid1.Rows - 1 & "条记录"
 Case 4
  MovePre Me.MSFlexGrid1
   Me.StatusBar1.Panels(1).Text = "总共有" & Me.MSFlexGrid1.Rows - 1 & "条记录"
 Case 5
  MoveNext Me.MSFlexGrid1
   Me.StatusBar1.Panels(1).Text = "总共有" & Me.MSFlexGrid1.Rows - 1 & "条记录"
 Case 6
  MoveLast Me.MSFlexGrid1
   Me.StatusBar1.Panels(1).Text = "总共有" & Me.MSFlexGrid1.Rows - 1 & "条记录"
 Case 8
  Frm_tscx.Refresh
 Case 9
  Unload Me
End Select
End Sub
3.4.5 用户登录界面代码设计
Private Sub cmb_qx_Click()
On Error GoTo lab
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sql As String
sql = "select * from 用户 where 用户权限='" + cmb_qx.Text + "'"
cnn.Open strcnn
rst.Open sql, cnn, 3, 1
cmb_yhm.Clear
Do While Not rst.EOF
cmb_yhm.AddItem rst!用户名
rst.MoveNext
Loop
rst.Close
cnn.Close
Exit Sub
lab:
MsgBox "请您先附加数据库!", vbExclamation, "提示"

End Sub
Private Sub Command1_Click()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sql As String

 << 上一页  [11] [12] [13] [14] [15] [16] 下一页

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