Private Sub Command9_Click() On Error GoTo err For i = 0 To 8 If Trim(txtcj(i).Text) > Text3.Text * 1 Then MsgBox "成绩大于预定值!", , "成绩第" & i + 1 & "项错误" Exit Sub End If Next i txtcj(9).Text = txtcj(0) * 1 + txtcj(1) * 1 + txtcj(2) * 1 + txtcj(3) * 1 + txtcj(4) * 1 + txtcj(5) * 1 * (Text2.Text * 1) + txtcj(6) * 1 * (Text2.Text * 1) + txtcj(7) * 1 * (Text2.Text * 1) + txtcj(8) * 1 * (Text2.Text * 1) If AddFlg = False Then Rs1.Open "select 语文,数学,英语,物理,化学,政治,历史,地理,生物,总分 from 成绩表 where 考试号='" & Trim(KSH.Caption) & "' and 考试性质='" & Text1.Text & "'", Con, adOpenStatic, adLockPessimistic, adCmdText Rs1!语文 = Trim(txtcj(0).Text) Rs1!数学 = Trim(txtcj(1).Text) Rs1!英语 = Trim(txtcj(2).Text) Rs1!物理 = Trim(txtcj(3).Text) Rs1!化学 = Trim(txtcj(4).Text) Rs1!政治 = Trim(txtcj(5).Text) * 1 * (Text2.Text * 1) Rs1!历史 = Trim(txtcj(6).Text) * 1 * (Text2.Text * 1) Rs1!地理 = Trim(txtcj(7).Text) * 1 * (Text2.Text * 1) Rs1!生物 = Trim(txtcj(8).Text) * 1 * (Text2.Text * 1) Rs1!总分 = Trim(txtcj(9).Text) Rs1.UpdateBatch adAffectAllChapters SBar1.Panels.Item(1) = "修改成功保存!" Rs1.Close Else CmdExe.ActiveConnection = Con CmdExe.CommandText = "insert into 成绩表(考试号,语文,数学,英语,物理,化学,政治,历史,地理,生物,总分,考试性质) values " & "(" & KSH.Caption & "," & txtcj(0).Text & "," & txtcj(1).Text & "," & txtcj(2).Text & "," & txtcj(3).Text & "," & txtcj(4).Text & "," & txtcj(5).Text * 1 * (Text2.Text * 1) & "," & txtcj(6).Text * 1 * (Text2.Text * 1) & "," & txtcj(7).Text * 1 * (Text2.Text * 1) & "," & txtcj(8).Text * 1 * (Text2.Text * 1) & "," & txtcj(9).Text & ",'" & Text1.Text & "')" CmdExe.Execute SBar1.Panels.Item(1) = "添加成功保存!" iCount = iCount + 1 End If Label3.Caption = "共添加" & iCount & "条记录"
rs.MoveNext If List1.ListIndex + 1 < List1.ListCount Then List1.ListIndex = List1.ListIndex + 1 End If
Display
Exit Sub err: Call ExecErr(Date, Me.Caption, err.Number, err.Source, err.Description) End Sub
Private Sub Form_Load() AddFlg = False iCount = 0 Set rs = New ADODB.Recordset Set Rs1 = New ADODB.Recordset Set CmdExe = New ADODB.Command
Dim rsbj As ADODB.Recordset Set rsbj = New ADODB.Recordset rsbj.Open "班级表", Con, adOpenStatic, adLockPessimistic, adCmdTable Combo1.Clear Do While Not rsbj.EOF Combo1.AddItem rsbj!班级 rsbj.MoveNext Loop &n
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 4/14/14