智能排课系统vb代码(14)

发布时间:2021-06-05

和智能智能排课系统1、2、3是一套

End If

End If

End Sub

Private Sub Command3_Click() '调整时间

Dim rt As New ADODB.Recordset

If (Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "") Then

MsgBox ("请输入完整信息")

Else

Set Rs = New ADODB.Recordset

SQL = "select * from 排课表"

Set Rs = Conn.Execute(SQL)

If Rs("上课时间") = Text5.Text Then

MsgBox ("该教室该时间段已被占用,请重新选择")

Text4.Text = ""

Text5.Text = ""

Else

Set Rs = New ADODB.Recordset

SQL = "update 排课表 set [上课时间]='" + Text5.Text + "' where [课程名称]='" + Text1.Text + "' and [教师姓名]='" + Text2.Text + "' and [教室名称]='" + Text4.Text + "'"

Set Rs = Conn.Execute(SQL)

MsgBox ("时间调整成功")

'Adodc1.Refresh

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text4.Text = ""

Text5.Text = ""

End If

End If

End Sub

Private Sub ShowData(Rs As ADODB.Recordset, Dgrid As MSFlexGrid)

'该过程用来在Dgrid网格中显示记录集RS中的内容

Dim RowNum As Integer

RowNum = 1 '代表MsFlexGrid控件的行数

Dgrid.Rows = RowNum '设置MsFlexGrid控件的行数

Dgrid.Cols = Rs.Fields.Count '设置MsFlexGrid控件的列数

For j = 0 To Rs.Fields.Count - 1 '遍列所有列

Dgrid.TextMatrix(0, j) = Rs.Fields(j).Name '把列名显示在设置MsFlexGrid控件的首行

Next j

Do While Not Rs.EOF '如果不是记录集的结尾

RowNum = RowNum + 1 '行数加1

Dgrid.Rows = RowNum '设置MsFlexGrid控件的行数

精彩图片

热门精选

大家正在看