首页上一页 1 下一页尾页 1 条记录 1/1页
用ado对象实现数据插入数据时产生错误
发表在VB答疑区
2008-11-09
是否精华
是
否
版块置顶:
是
否
Dim con As New adodb.Connection
Dim rs As New adodb.Recordset
Dim i As Integer
Private Sub Command1_Click()
con.Open "dsn=stud"
rs.Open "select*from xueshen", con, adOpenKeyset, adLockOptimistic
rs.AddNew
For i = 0 To 4
rs.Fields(i) = Trim(Text1(i).Text)
Next i
rs.Fields(5) = Str(Combo1.Text)
For i = 5 To 6
rs.Fields(i) = Str(DTPicker1(i).Value)
Next i
MsgBox "成功添加数据", 48, "学生宿舍管理系统"
rs.Update
Set xsbg.DataSource = con.Execute("select*from xueshen")
rs.Clone
con.Close
End Sub
Dim rs As New adodb.Recordset
Dim i As Integer
Private Sub Command1_Click()
con.Open "dsn=stud"
rs.Open "select*from xueshen", con, adOpenKeyset, adLockOptimistic
rs.AddNew
For i = 0 To 4
rs.Fields(i) = Trim(Text1(i).Text)
Next i
rs.Fields(5) = Str(Combo1.Text)
For i = 5 To 6
rs.Fields(i) = Str(DTPicker1(i).Value)
Next i
MsgBox "成功添加数据", 48, "学生宿舍管理系统"
rs.Update
Set xsbg.DataSource = con.Execute("select*from xueshen")
rs.Clone
con.Close
End Sub