类型不匹配
Dim con As New adodb.ConnectionDim rs As New adodb.Recordset
Private Sub Command1_Click()
con.Open "dsn=stud"
rs.Open "select*from xueshen", con, adOpenKeyset, adLockOptimistic
rs.AddNew
rs.Fields(1) = Trim(Text1.Text)
rs.Fields(2) = Trim(Text2.Text)
rs.Fields(3) = Combo1.Text
rs.Fields(4) = Trim(Text3.Text) 这一
rs.Fields(7) = Trim(Text4.Text)
rs.Fields(8) = Trim(Text5.Text)
rs.Fields(9) = Trim(Text6.Text)
rs.Fields(5) = Str(DTPicker1.Value)
rs.Fields(6) = Str(DTPicker2.Value)
MsgBox "成功添加数据", 48, "学生宿舍管理系统"
rs.Update
Set xsbg.DataSource = con.Execute("select*from xueshen")
rs.Close
con.Close
End Sub行