conn.open ss vb 代码有问题,帮忙解决一下
我要建立一个简单的成绩查询系统,在窗体建立了n个label1,n个text1,用于显示与标签相对应的内容,数据来源于数据库,conn.open.ss提示有错误,rs.Op...
我要 建立一个简单的成绩查询系统,在窗体建立了n个label1,n个text1,用于显示与标签相对应的内容,数据来源于数据库,conn.open.ss提示有错误,rs.Open qs, conn, 1, 3, -1也有问题
Private Sub Command1_Click()
ss = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Admin\桌面\甄建慧\061184\student_score.mdb;Persist Security Info=False;Persist Security Info=False"
Set conn = New adodb.Connection
conn.ConnectionString = pconn
conn.Open ss
qs = "select * from 学生成绩表 where 学号=" + Text1.Text
rs.Open qs, conn, 1, 3, -1
Label1.Caption = rs.Fields(1)
Label2.Caption = rs.Fields(2)
Label3.Caption = rs.Fields(3)
Label4.Caption = rs.Fields(4)
Label5.Caption = rs.Fields(5)
Label6.Caption = rs.Fields(6)
Label7.Caption = rs.Fields(7)
Label8.Caption = rs.Fields(8)
Label9.Caption = rs.Fields(9)
Label10.Caption = rs.Fields(10)
Label11.Caption = rs.Fields(11)
Label12.Caption = rs.Fields(12)
Label13.Caption = rs.Fields(13)
conn.Close
End Sub
rs.Open qs, conn, 3,1这句有错误,我试着该成rs.Open qs, conn, 1,3还是不行,帮忙解决一下 展开
Private Sub Command1_Click()
ss = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Admin\桌面\甄建慧\061184\student_score.mdb;Persist Security Info=False;Persist Security Info=False"
Set conn = New adodb.Connection
conn.ConnectionString = pconn
conn.Open ss
qs = "select * from 学生成绩表 where 学号=" + Text1.Text
rs.Open qs, conn, 1, 3, -1
Label1.Caption = rs.Fields(1)
Label2.Caption = rs.Fields(2)
Label3.Caption = rs.Fields(3)
Label4.Caption = rs.Fields(4)
Label5.Caption = rs.Fields(5)
Label6.Caption = rs.Fields(6)
Label7.Caption = rs.Fields(7)
Label8.Caption = rs.Fields(8)
Label9.Caption = rs.Fields(9)
Label10.Caption = rs.Fields(10)
Label11.Caption = rs.Fields(11)
Label12.Caption = rs.Fields(12)
Label13.Caption = rs.Fields(13)
conn.Close
End Sub
rs.Open qs, conn, 3,1这句有错误,我试着该成rs.Open qs, conn, 1,3还是不行,帮忙解决一下 展开
2个回答
展开全部
ss = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Admin\桌面\甄建慧\061184\student_score.mdb;Persist Security Info=False;Persist Security Info=False"
要用相对路径student_score.mdb要和代码文件放在一起
改为:ss = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student_score.mdb;Persist Security Info=False;Persist Security Info=False"
rs.Open qs, conn, 1, 3, -1
改为
rs.Open qs, conn, 1,3
要用相对路径student_score.mdb要和代码文件放在一起
改为:ss = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student_score.mdb;Persist Security Info=False;Persist Security Info=False"
rs.Open qs, conn, 1, 3, -1
改为
rs.Open qs, conn, 1,3
展开全部
ss = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Admin\桌面\甄建慧\061184\student_score.mdb;Persist Security Info=False;Persist Security Info=False"
Set conn = New adodb.Connection
conn.ConnectionString = ss
conn.Open
dim rs as new ADODB.RecordSet
qs = "select * from 学生成绩表 where 学号=" + Text1.Text
rs.Open qs, conn, 3,1
Label1.Caption = rs.Fields(1)
Label2.Caption = rs.Fields(2)
Label3.Caption = rs.Fields(3)
Label4.Caption = rs.Fields(4)
Label5.Caption = rs.Fields(5)
Label6.Caption = rs.Fields(6)
Label7.Caption = rs.Fields(7)
Label8.Caption = rs.Fields(8)
Label9.Caption = rs.Fields(9)
Label10.Caption = rs.Fields(10)
Label11.Caption = rs.Fields(11)
Label12.Caption = rs.Fields(12)
Label13.Caption = rs.Fields(13)
rs.close
conn.Close
补充 qs = "select * from 学生成绩表 where 学号='" & Text1.Text & "'"
Set conn = New adodb.Connection
conn.ConnectionString = ss
conn.Open
dim rs as new ADODB.RecordSet
qs = "select * from 学生成绩表 where 学号=" + Text1.Text
rs.Open qs, conn, 3,1
Label1.Caption = rs.Fields(1)
Label2.Caption = rs.Fields(2)
Label3.Caption = rs.Fields(3)
Label4.Caption = rs.Fields(4)
Label5.Caption = rs.Fields(5)
Label6.Caption = rs.Fields(6)
Label7.Caption = rs.Fields(7)
Label8.Caption = rs.Fields(8)
Label9.Caption = rs.Fields(9)
Label10.Caption = rs.Fields(10)
Label11.Caption = rs.Fields(11)
Label12.Caption = rs.Fields(12)
Label13.Caption = rs.Fields(13)
rs.close
conn.Close
补充 qs = "select * from 学生成绩表 where 学号='" & Text1.Text & "'"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询