论文无忧网提供:计算机毕业论文范文|计算机毕业设计|计算机毕业论文
栏目导航 ASP Java Web .NET VB6.0 JAVA VC VF DELPHI PB 计算机网络 计算机科学与技术 PHP 安卓APP 其他 C# 代写论文
当前位置: > 计算机 > VB6.0 >

A400216学生管理系统1(vb+sql)

3.5班级管理

班级添加窗体代码如下 copyright paper51.com

Dim strClassstr As String http://www.paper51.com

'使此窗体可以应用于“添加”和“修改”两种状态。

copyright paper51.com

Public Sub classload()

内容来自论文无忧网 www.paper51.com

   Dim mrc As ADODB.Recordset

http://www.paper51.com

   If classmodi Then  '如果是修改状态

http://www.paper51.com

       Me.Caption = "修改班级设置"

http://www.paper51.com

       classstr = "select * from class where 班级='" &Trim(Formclass2.MSF1.TextMatrix(Formclass2.MSF1.Row, 2)) & "'" http://www.paper51.com

        Setmrc = ExecuteSQL(classstr)

copyright paper51.com

       mrc.MoveFirst

copyright paper51.com

        Fori = 0 To 6

paper51.com

           Text1(i).Text = mrc.Fields(i) copyright paper51.com

        Nexti http://www.paper51.com

       mrc.Close

内容来自论文无忧网 www.paper51.com

   Else http://www.paper51.com

       Me.Caption = "添加班级设置"

内容来自论文无忧网 www.paper51.com

        Fori = 0 To 6

内容来自论文无忧网 www.paper51.com

           Text1(i).Text = ""

内容来自论文无忧网 www.paper51.com

        Nexti

copyright paper51.com

   End If http://www.paper51.com

End Sub

paper51.com

'根据条件,确定是否可以“添加”或“修改”班级信息。 paper51.com

Private Sub Command1_Click() copyright paper51.com

   For j = 0 To 5

copyright paper51.com

        If Text1(j) = "" Then

copyright paper51.com

           ss = MsgBox(Label2(j).Caption & "不能为空!",vbExclamation + vbOKOnly, "警告")

内容来自论文无忧网 www.paper51.com

           Text1(j).SetFocus copyright paper51.com

           Text1(j).SelStart = 0 copyright paper51.com

           Text1(j).SelLength = Len(Text1(j).Text)

内容来自www.paper51.com

           Exit Sub 内容来自www.paper51.com

        EndIf copyright paper51.com

   Next

内容来自www.paper51.com

   Dim mrc As ADODB.Recordset

paper51.com

   If classmodi = False Then copyright paper51.com

       classstr = "select * from class where 班级='" & Trim(Text1(1).Text) & "'"

http://www.paper51.com

        Setmrc = ExecuteSQL(classstr)

内容来自论文无忧网 www.paper51.com

        Ifmrc.EOF = False Then copyright paper51.com

           sss = MsgBox("已经存在该班级的设置,不能重复!",vbonly, "警告") http://www.paper51.com

           Text1(1).SetFocus http://www.paper51.com

           Text1(1).SelStart = 0

内容来自论文无忧网 www.paper51.com

           Text1(1).SelLength = Len(Text1(1).Text) 内容来自论文无忧网 www.paper51.com

           mrc.Close

内容来自论文无忧网 www.paper51.com

           Exit Sub paper51.com

        EndIf copyright paper51.com

   End If

paper51.com

   classstr = "delete * from class where 班级='" & Trim(Text1(1).Text) & "'"

内容来自论文无忧网 www.paper51.com

   Set mrc = ExecuteSQL(classstr) http://www.paper51.com

   classstr = "select * from class "

内容来自www.paper51.com

   Set mrc = ExecuteSQL(classstr) http://www.paper51.com

   mrc.AddNew

paper51.com

   For i = 0 To 6 内容来自www.paper51.com

        If Text1(6).Text = "" Then

paper51.com

           Text1(6).Text = "无" http://www.paper51.com

        EndIf copyright paper51.com

        mrc.Fields(i) = Text1(i).Text

内容来自www.paper51.com

   Next i paper51.com

   mrc.Update

http://www.paper51.com

   If classmodi Then

paper51.com

       Unload Me copyright paper51.com

       'Formclass2.classshowtitle

copyright paper51.com

       'Formclass2.classshowdata 内容来自论文无忧网 www.paper51.com

   Else

copyright paper51.com

        Forj = 0 To 6

copyright paper51.com

           Text1(j) = ""

paper51.com

        Next

copyright paper51.com

       'MDIForm1.classbrowse_Click copyright paper51.com

   End If 内容来自www.paper51.com

End Sub

内容来自论文无忧网 www.paper51.com

Private Sub Command2_Click()

内容来自论文无忧网 www.paper51.com

   Unload Me paper51.com

End Sub 内容来自www.paper51.com

Private Sub Form_Activate()

paper51.com

   Text1(0).SetFocus http://www.paper51.com

End Sub 内容来自论文无忧网 www.paper51.com

班级浏览窗体代码如下 http://www.paper51.com

Public strPrintstr As String paper51.com

'显示MSFlexGrid的标题 http://www.paper51.com

Public Sub classshowtitle()

copyright paper51.com

   Dim i As Integer 内容来自www.paper51.com

   MSF1.Clear

内容来自论文无忧网 www.paper51.com

   With MSF1 http://www.paper51.com

       .Cols = 8 copyright paper51.com

       .TextMatrix(0, 1) = "年级" copyright paper51.com

       .TextMatrix(0, 2) = "班级" copyright paper51.com

       .TextMatrix(0, 3) = "教室"

内容来自www.paper51.com

        .TextMatrix(0, 4)= "年制"

copyright paper51.com

       .TextMatrix(0, 5) = "专业" http://www.paper51.com

       .TextMatrix(0, 6) = "班主任" 内容来自论文无忧网 www.paper51.com

       .TextMatrix(0, 7) = "备注" 内容来自论文无忧网 www.paper51.com

        .ColWidth(0) = 100

内容来自www.paper51.com

        .ColWidth(1) = 1300

paper51.com

        .ColWidth(2) = 1200

copyright paper51.com

        .ColWidth(3) = 800 http://www.paper51.com

        .ColWidth(4) = 800

copyright paper51.com

        .ColWidth(5) = 800

http://www.paper51.com

        .ColWidth(6) = 800

内容来自论文无忧网 www.paper51.com

        .ColWidth(7) = 5000

paper51.com

       .FixedRows = 1 copyright paper51.com

        Fori = 1 To 7

内容来自论文无忧网 www.paper51.com

           .ColAlignment(i) = 0

内容来自论文无忧网 www.paper51.com

        Nexti

内容来自论文无忧网 www.paper51.com

       .FillStyle = flexFillSingle

copyright paper51.com

        .Col= 0

内容来自论文无忧网 www.paper51.com

        .Row= 0

copyright paper51.com

       .RowSel = 1 内容来自论文无忧网 www.paper51.com

       .ColSel = .Cols - 1

paper51.com

       .CellAlignment = 4 copyright paper51.com

        .Row= 1

http://www.paper51.com

   End With

paper51.com

End Sub 内容来自论文无忧网 www.paper51.com

'显示MSFlexGrid的内容

内容来自www.paper51.com

Public Sub classshowdata()

内容来自www.paper51.com

   Dim j As Integer 内容来自论文无忧网 www.paper51.com

   Dim i As Integer 内容来自论文无忧网 www.paper51.com

   Dim mrc1 As ADODB.Recordset paper51.com

   Set mrc1 = ExecuteSQL(Trim(txtsql))

paper51.com

   If mrc1.EOF = False Then

paper51.com

       mrc1.MoveFirst 内容来自www.paper51.com

        WithMSF1 paper51.com

           .Rows = 1

paper51.com

            Do WhileNot mrc1.EOF

内容来自论文无忧网 www.paper51.com

               .Rows = .Rows + 1 http://www.paper51.com

               For i = 1 To mrc1.Fields.Count

copyright paper51.com

                   .TextMatrix(.Rows - 1, i) = mrc1.Fields(i - 1) 内容来自论文无忧网 www.paper51.com

               Next i 内容来自论文无忧网 www.paper51.com

               mrc1.MoveNext

copyright paper51.com

           Loop 内容来自www.paper51.com

           mrc1.Close copyright paper51.com

        EndWith copyright paper51.com

   Else paper51.com

        Ifclassfind = True Then copyright paper51.com

           Formclass2.Hide copyright paper51.com

           Formclass3.Show

paper51.com

           zzz = MsgBox("对不起,没有此班级的档案记录!", vbOKOnly, "查询")

内容来自www.paper51.com

           Formclass3.ZOrder (0)

内容来自论文无忧网 www.paper51.com

           Formclass3.Text1(0).SetFocus

http://www.paper51.com

        EndIf

内容来自论文无忧网 www.paper51.com

   End If

copyright paper51.com

End Sub paper51.com

 

paper51.com

------分隔线----------------------------
联系方式