frmjiben.frm
上传用户:bubble
上传日期:2007-03-02
资源大小:403k
文件大小:12k
- VERSION 5.00
- Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
- Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
- Begin VB.Form frmjiben
- BorderStyle = 1 'Fixed Single
- Caption = "基本课程设置"
- ClientHeight = 5910
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 4920
- LinkTopic = "Form2"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 5910
- ScaleWidth = 4920
- Begin VB.Frame Frame1
- Caption = "基本课程设置"
- Height = 5775
- Left = 120
- TabIndex = 1
- Top = 0
- Width = 4695
- Begin MSAdodcLib.Adodc Adodc1
- Height = 375
- Left = 3120
- Top = 5760
- Visible = 0 'False
- Width = 1200
- _ExtentX = 2117
- _ExtentY = 661
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 8
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = ""
- OLEDBString = ""
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = ""
- Caption = "Adodc1"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin VB.CommandButton Command4
- Caption = "修改"
- Height = 375
- Left = 3480
- TabIndex = 12
- Top = 3720
- Width = 1095
- End
- Begin VB.Frame Frame4
- Caption = "教材:"
- Height = 735
- Left = 120
- TabIndex = 10
- Top = 4800
- Width = 3135
- Begin VB.TextBox Text2
- BackColor = &H80000018&
- Enabled = 0 'False
- Height = 350
- Left = 120
- TabIndex = 11
- Top = 240
- Width = 2895
- End
- End
- Begin VB.CommandButton Command3
- Caption = "删除"
- Height = 375
- Left = 3480
- TabIndex = 7
- Top = 4680
- Width = 1095
- End
- Begin VB.CommandButton Command2
- Caption = "增加"
- Height = 375
- Left = 3480
- TabIndex = 6
- Top = 4200
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "退出"
- Height = 375
- Left = 3480
- TabIndex = 5
- Top = 5160
- Width = 1095
- End
- Begin VB.Frame Frame3
- Caption = "提示"
- Height = 3375
- Left = 3480
- TabIndex = 4
- Top = 240
- Width = 1095
- Begin VB.Label Label2
- Caption = " 选中列表框中条目点击删除钮即可删除选中条目。 "
- Height = 1335
- Left = 120
- TabIndex = 9
- Top = 1920
- Width = 855
- End
- Begin VB.Label Label1
- Alignment = 2 'Center
- Caption = " 在新增资料对话框中输入新的课和条目,按回车即可完成添加资料。"
- Height = 1500
- Left = 120
- TabIndex = 8
- Top = 240
- Width = 825
- End
- End
- Begin VB.Frame Frame2
- Caption = "课程名称:"
- Height = 615
- Left = 120
- TabIndex = 2
- Top = 4200
- Width = 3135
- Begin VB.TextBox Text1
- BackColor = &H80000018&
- Enabled = 0 'False
- Height = 350
- Left = 120
- TabIndex = 3
- Top = 240
- Width = 2895
- End
- End
- Begin MSFlexGridLib.MSFlexGrid MSF1
- Height = 3975
- Left = 120
- TabIndex = 0
- Top = 240
- Width = 3165
- _ExtentX = 5583
- _ExtentY = 7011
- _Version = 393216
- BackColor = -2147483624
- BackColorFixed = 12632256
- ForeColorFixed = 0
- BackColorSel = 16777215
- ForeColorSel = 255
- BackColorBkg = -2147483624
- AllowBigSelection= -1 'True
- SelectionMode = 1
- AllowUserResizing= 3
- 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
- End
- End
- Attribute VB_Name = "frmjiben"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public Sub kechengshowtitle()
- MSF1.Clear
- Dim i As Integer
- With MSF1
- .Cols = 3
- .TextMatrix(0, 1) = "课程名称"
- .TextMatrix(0, 2) = "教材"
-
- .ColWidth(0) = 0
- .ColWidth(1) = 1000
- .ColWidth(2) = 2000
-
- .FixedRows = 1
-
- .FillStyle = flexFillSingle
- .Col = 0
- .Row = 0
- .RowSel = 1
- .ColSel = .Cols - 1
- .CellAlignment = 4
- .Row = 1
- End With
- End Sub
- Private Sub Command1_Click()
- Unload Me
- End Sub
- Private Sub Command2_Click()
- qxstr = Executeqx(4)
- If qxstr = "readonly" Then
- ss = MsgBox("对不起,你是只读用户不能添加记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
- Exit Sub
- End If
- If Command2.Caption = "确定" Then
- If Text1.Text = "" Then
- sssss = MsgBox("课程名称不能为空!", vbOKOnly + vbExclamation, "警告")
- Text1.SetFocus
- Exit Sub
- End If
- If Text2.Text = "" Then
- sssss = MsgBox("教材不能为空!", vbOKOnly + vbExclamation, "警告")
- Text2.SetFocus
- Exit Sub
- End If
-
-
- Adodc1.RecordSource = "select * from allkecheng where 课程名称='" & Trim(Text1.Text) & "'"
- Adodc1.Refresh
- If Adodc1.Recordset.EOF = False Then
- sssss = MsgBox("已经存在该课程名称!", vbOKOnly + vbExclamation, "警告")
- Text1.SetFocus
- Text1.SelStart = 0
- Text1.SelLength = Len(Text1.Text)
- Exit Sub
- Else
- Adodc1.Recordset.AddNew
- Adodc1.Recordset.Fields(0) = Text1.Text
- Adodc1.Recordset.Fields(1) = Text2.Text
- Adodc1.Recordset.Update
- Command2.Caption = "增加"
- Command3.Enabled = True
- Command4.Enabled = True
- Text1.Text = ""
- Text2.Text = ""
- Text1.Enabled = False
- Text2.Enabled = False
- kechengshowtitle
- kechengshowdata
-
- End If
- Else
- Text1.Enabled = True
- Text2.Enabled = True
- Text1.Text = ""
- Text2.Text = ""
- Text1.SetFocus
- kechengshowtitle
- kechengshowdata
- Command2.Caption = "确定"
- Command3.Enabled = False
- Command4.Enabled = False
- End If
- End Sub
- Private Sub Command3_Click()
- qxstr = Executeqx(4)
- If qxstr = "readonly" Then
- ss = MsgBox("对不起,你是只读用户不能添加记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
- Exit Sub
- End If
- If Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) = "" Then
- sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
- Else
- If MsgBox("确定要删除 课程名称 为 " & Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) & " 的记录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
- Adodc1.RecordSource = "select * from allkecheng where 课程名称='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) & "'"
- Adodc1.Refresh
- Adodc1.Recordset.Delete
- Text1.Text = ""
- Text2.Text = ""
- kechengshowtitle
- kechengshowdata
- End If
- End If
- End Sub
- Private Sub Command4_Click()
- qxstr = Executeqx(4)
- If qxstr = "readonly" Then
- ss = MsgBox("对不起,你是只读用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
- Exit Sub
- End If
- If Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) = "" Then
- sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
- Else
- If Command4.Caption = "确定" Then
- If Text1.Text = "" Then
- sssss = MsgBox("课程名称不能为空!", vbOKOnly + vbExclamation, "警告")
- Text1.SetFocus
- Exit Sub
- End If
- If Text2.Text = "" Then
- sssss = MsgBox("教材不能为空!", vbOKOnly + vbExclamation, "警告")
- Text2.SetFocus
- Exit Sub
- End If
- Adodc1.RecordSource = "select * from allkecheng where 课程名称='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) & "'"
- Adodc1.Refresh
- Adodc1.Recordset.Fields(0) = Text1.Text
- Adodc1.Recordset.Fields(1) = Text2.Text
- Adodc1.Recordset.Update
- Text1.Text = ""
- Text2.Text = ""
- kechengshowtitle
- kechengshowdata
- Command4.Caption = "修改"
- Command2.Enabled = True
- Command3.Enabled = True
- Text1.Enabled = False
- Text2.Enabled = False
- Else
- Text1.Enabled = True
- Text2.Enabled = True
- Text1.SetFocus
- Command4.Caption = "确定"
- Command2.Enabled = False
- Command3.Enabled = False
- End If
- End If
- End Sub
- Private Sub Form_Load()
- Adodc1.ConnectionString = connstring
- kechengshowtitle
- kechengshowdata
- End Sub
- Public Sub kechengshowdata()
- Dim j As Integer
- Dim i As Integer
- Dim mrc As ADODB.Recordset
- Adodc1.RecordSource = "select * from allkecheng order by 课程名称"
- Adodc1.Refresh
- If Adodc1.Recordset.EOF = False Then
- Adodc1.Recordset.MoveFirst
- With MSF1
- .Rows = 15
- .Row = 2
-
- Do While Not Adodc1.Recordset.EOF
- .Rows = .Rows + 1
- For i = 1 To Adodc1.Recordset.Fields.Count
- .TextMatrix(.Row - 1, i) = Adodc1.Recordset.Fields(i - 1)
- Next i
- .Row = .Row + 1
- Adodc1.Recordset.MoveNext
- Loop
- End With
- End If
- End Sub
- Private Sub MSF1_Click()
- If Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) = "" Then
- Text1.Text = ""
- Text2.Text = ""
- Else
- Adodc1.RecordSource = "select * from allkecheng where 课程名称='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) & "'"
- Adodc1.Refresh
- Text1.Text = Adodc1.Recordset.Fields(0)
- Text2.Text = Adodc1.Recordset.Fields(1)
- End If
- End Sub
- Private Sub Text1_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- Text2.SetFocus
- End If
- End Sub