VB6.0中 该代码显示 未找到方法或数据成员 请问为什么?
PrivateSubCommand1_Click()DimdbAsNewADODB.ConnectionDimrsAsNewADODB.RecordsetSetdb=Ne...
Private Sub Command1_Click()
Dim db As New ADODB.Connection
Dim rs As New ADODB.Recordset
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=D:\VB\学生信息表1.mdb;Persist Security Info=False"
db.Open
Dim sql, rt As String
Dim zy, bj, xh, xm, xb, jg, csny, jtzz, lxdh, zzmm, bz As String
sql = "select * from 学生信息表"
rs.Open sql, db, adOpenStatic, adLockOptimistic
rs.AddNew
rs.Fields(0).Value = Text1.Text
rs.Fields(1).Value = Text2.Text
rs.Fields(2).Value = Text3.Text
rs.Fields(3).Value = Text4.Text
rs.Fields(4).Value = Text5.Text
rs.Fields(5).Value = Text6.Text
rs.Fields(6).Value = Text7.Text
rs.Fields(7).Value = Text8.Text
rs.Fields(8).Value = Text9.Text
rs.Fields(9).Value = Text10.Text
rs.Fields(10).Value = Text11.Text
rs.Update
MsgBox ("增加成功")
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
End Sub 展开
Dim db As New ADODB.Connection
Dim rs As New ADODB.Recordset
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=D:\VB\学生信息表1.mdb;Persist Security Info=False"
db.Open
Dim sql, rt As String
Dim zy, bj, xh, xm, xb, jg, csny, jtzz, lxdh, zzmm, bz As String
sql = "select * from 学生信息表"
rs.Open sql, db, adOpenStatic, adLockOptimistic
rs.AddNew
rs.Fields(0).Value = Text1.Text
rs.Fields(1).Value = Text2.Text
rs.Fields(2).Value = Text3.Text
rs.Fields(3).Value = Text4.Text
rs.Fields(4).Value = Text5.Text
rs.Fields(5).Value = Text6.Text
rs.Fields(6).Value = Text7.Text
rs.Fields(7).Value = Text8.Text
rs.Fields(8).Value = Text9.Text
rs.Fields(9).Value = Text10.Text
rs.Fields(10).Value = Text11.Text
rs.Update
MsgBox ("增加成功")
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
End Sub 展开
展开全部
确认您的数据库中有“学生信息表”这个表,而且通常情况下不建议使用中文表名称,还有就是看一下表里的字段信息,确定数据类型之类的信息匹配。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
rs.Fields(0).Value = Text1.Text
类似这样的写法改为直接写字段名
rs("字段名")=text1.text
还有,若数据库中的表或字段是中文的,最好加上 [ ] ,以免出现未知的错误,如
sql = "select * from [学生信息表]"
类似这样的写法改为直接写字段名
rs("字段名")=text1.text
还有,若数据库中的表或字段是中文的,最好加上 [ ] ,以免出现未知的错误,如
sql = "select * from [学生信息表]"
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你应该说明是在哪儿出来这个错误的,不然不好说。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询