我用VB编写了一个考试系统,在模块里写了这么一段,Sub Chouti(ByVal zhkzhh As String, name As String)
Dim Czt_gs As Integer '选择题中操作题的个数
Dim Word_gs As Integer '选择题中Word题的个数
Dim Excel_gs As Integer '选择题中Excel题的个数
Dim Oa_gs As Integer '选择题中办公自动化题的个数
Dim Wl_gs As Integer '选择题中网络题的个数
Call create_HJ(8, Mid(zhkzhh, 1, 4) & Right(zhkzhh, 4), "") '建立考生目录
'抽取选择题
'strConnect = "Provider=Microsoft.JET.OLEDB.3.51;Data Source=" & Mypath & "ksxt.mdb;Jet OLEDB:Database Password=853211" '对于ADO控件, 应该把这个字符串添加在ConnectionString属性后面 。
strConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ksxt;Data Source=xxd"
strSQL = "SELECT * FROM 选择题表 "
With Rec
If .State = adStateOpen Then
.Close
End If
.Source = ""
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.ActiveConnection = strConnect
.Open strSQL, Options:=adCmdText
End With
'strConnect1 = "Provider=Microsoft.JET.OLEDB.3.51;Data Source=" & Mypath & "kaosheng.mdb;Jet OLEDB:Database Password=853211"
strConnect1 = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ksxt;Data Source=xxd"
strSQL1 = "SELECT * FROM 选择题表 "
With Rec1
If .State = adStateOpen Then
.Close
End If
.Source = ""
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.ActiveConnection = strConnect1
.Open strSQL1, Options:=adCmdText
End With
'strConnect1 = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ksxt;Data Source=xxd"
strSQL2 = "select * from 选择题考核点表 where Left(考核点编号, 1) ='C'"
With Rec2
If .State = adStateOpen Then
.Close
End If
.Source = ""
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.ActiveConnection = strConnect
.Open strSQL2, Options:=adCmdText
End With
If Not (Rec.BOF And Rec.EOF) Then
Rec.MoveFirst
Do While Not Rec.EOF
Rec!标志 = "N"
Rec.Update
Rec.MoveNext
Loop
End If
If Rec.RecordCount <= 30 Then
'抽取全集
Rec.MoveFirst
Do While Not Rec.EOF
Rec1.AddNew
Rec1!准考证号 = UCase(zhkzhh)
Rec1!姓名 = name
Rec1!题目号 = Rec!题目号
Rec1!考核点编号 = Rec!考核点编号
Rec1!题目说明 = Rec!题目说明
Rec1!选项1 = Rec!选项1
Rec1!选项2 = Rec!选项2
Rec1!选项3 = Rec!选项3
Rec1!选项4 = Rec!选项4
Rec1!标准答案 = Rec!标准答案
Rec1!考生答案 = "0"
Rec1!分值 = Rec!分值
Rec1.Update
Rec.MoveNext
但是程序执行到 Rec1!准考证号 = UCase(zhkzhh),就出现了“在对应所需名称或序数的集合中,未找到项目”,怎么调也不行,怎么办啊,各位大侠快救救我。
Dim Czt_gs As Integer '选择题中操作题的个数
Dim Word_gs As Integer '选择题中Word题的个数
Dim Excel_gs As Integer '选择题中Excel题的个数
Dim Oa_gs As Integer '选择题中办公自动化题的个数
Dim Wl_gs As Integer '选择题中网络题的个数
Call create_HJ(8, Mid(zhkzhh, 1, 4) & Right(zhkzhh, 4), "") '建立考生目录
'抽取选择题
'strConnect = "Provider=Microsoft.JET.OLEDB.3.51;Data Source=" & Mypath & "ksxt.mdb;Jet OLEDB:Database Password=853211" '对于ADO控件, 应该把这个字符串添加在ConnectionString属性后面 。
strConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ksxt;Data Source=xxd"
strSQL = "SELECT * FROM 选择题表 "
With Rec
If .State = adStateOpen Then
.Close
End If
.Source = ""
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.ActiveConnection = strConnect
.Open strSQL, Options:=adCmdText
End With
'strConnect1 = "Provider=Microsoft.JET.OLEDB.3.51;Data Source=" & Mypath & "kaosheng.mdb;Jet OLEDB:Database Password=853211"
strConnect1 = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ksxt;Data Source=xxd"
strSQL1 = "SELECT * FROM 选择题表 "
With Rec1
If .State = adStateOpen Then
.Close
End If
.Source = ""
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.ActiveConnection = strConnect1
.Open strSQL1, Options:=adCmdText
End With
'strConnect1 = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ksxt;Data Source=xxd"
strSQL2 = "select * from 选择题考核点表 where Left(考核点编号, 1) ='C'"
With Rec2
If .State = adStateOpen Then
.Close
End If
.Source = ""
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.ActiveConnection = strConnect
.Open strSQL2, Options:=adCmdText
End With
If Not (Rec.BOF And Rec.EOF) Then
Rec.MoveFirst
Do While Not Rec.EOF
Rec!标志 = "N"
Rec.Update
Rec.MoveNext
Loop
End If
If Rec.RecordCount <= 30 Then
'抽取全集
Rec.MoveFirst
Do While Not Rec.EOF
Rec1.AddNew
Rec1!准考证号 = UCase(zhkzhh)
Rec1!姓名 = name
Rec1!题目号 = Rec!题目号
Rec1!考核点编号 = Rec!考核点编号
Rec1!题目说明 = Rec!题目说明
Rec1!选项1 = Rec!选项1
Rec1!选项2 = Rec!选项2
Rec1!选项3 = Rec!选项3
Rec1!选项4 = Rec!选项4
Rec1!标准答案 = Rec!标准答案
Rec1!考生答案 = "0"
Rec1!分值 = Rec!分值
Rec1.Update
Rec.MoveNext
但是程序执行到 Rec1!准考证号 = UCase(zhkzhh),就出现了“在对应所需名称或序数的集合中,未找到项目”,怎么调也不行,怎么办啊,各位大侠快救救我。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货