新建了一个模块,里面定义了
Public Conn As New ADODB.Connection 在一个按钮的单击事件中:
Dim chaxun1, chaxun2, jigelv As String
chaxun1 = "select count(*) as bjg from 学生 where Stu_Score>80"
chaxun2 = "select count(*) as total from 学生"
jigelv = chaxun1 & chaxun2
Conn.RecordSource = jigelv
Conn.Refresh
Label1.Caption = CStr(Conn.Recordset(1))错误提示:
实时错误:446
对象不支持命名参数怎么办?
Public Conn As New ADODB.Connection 在一个按钮的单击事件中:
Dim chaxun1, chaxun2, jigelv As String
chaxun1 = "select count(*) as bjg from 学生 where Stu_Score>80"
chaxun2 = "select count(*) as total from 学生"
jigelv = chaxun1 & chaxun2
Conn.RecordSource = jigelv
Conn.Refresh
Label1.Caption = CStr(Conn.Recordset(1))错误提示:
实时错误:446
对象不支持命名参数怎么办?
public Rs as new adodb.recordset '加一句声明Recordset
Dim chaxun1, chaxun2, jigelv As String
chaxun1 = "select count(*) as bjg from 学生 where Stu_Score>80"
if rs.state=1 then rs.close
rs.open chaxun1,conn,3,3Label1.Caption =rs(1)Recodset和connection是两个不同的东西,conn后面是不存在recodset的
chaxun1 = "select count(*) as bjg from 学生 where Stu_Score>80"
chaxun2 = "select count(*) as total from 学生"
jigelv = chaxun1 & chaxun2
Conn.RecordSource = jigelv
相当于
Conn.RecordSource ="select count(*) as bjg from 学生 where Stu_Score>80select count(*) as total from 学生"这能行吗?
一般不会出现这种问题吧,没有提示吗