Dim strCnn, SQL As String
Dim Rs As New Adodb.Recordset
Dim Cnn As Adodb.Connection
Dim I As Integer Private Sub Form_Load()
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;persist Security Info=false"
Set Cnn = New Adodb.Connection
Cnn.open strCnn
SQL = "select*from 表1"
Cnn.Execute SQL
Set Rs = New Adodb.Recordset
Rs.open SQL, Cnn, adOpenDynamic, adLockBatchOptimistic
Rs.MoveFirst
Call ViewData
End Sub Private Sub ViewData()
DTP1.Value = "1980-12-11" 'Rs.Fields("日期")
Text1(0).Text = Rs.Fields("姓名")
Text1(1).Text = "null" 'Rs.Fields("其他")
Me.Caption = "现在看的是" & Rs.Fields("日期") & "的情况"
End Sub Private Sub Command2_Click()
Rs.Update
End Sub其他代码我省略了,这个Command2是我想制定的一个修改按钮,我更改Text1()的内容为什么不能修改并保存数据库?
我是看一本书上的请各位指点,谢谢大家

解决方案 »

  1.   

    你把text 与数据库连接上了吗
    在text 的dataresource属性中
    试一下
      

  2.   

    Rs.Find 條件
    Rs.Edit
    Rs.Fields("日期")= "1980-12-11"
     Rs.Fields("姓名")= Text1(0).Text
    Rs.Fields("其他")= Text1(1).Text 
    Rs.Update
    ============或者==================
    Conn.Execute "update 表1 set 日期='" & "1980-12-11" & "',set 姓名='" & Text1(0).Text & ",set 其他='" & Text1(1).Text & "'" & " where 條件"
      

  3.   

    各位帮我看看吧
    我上传了rar
    http://chenyu.bigwww.com/UploadFile/2004-7/200471719344423.rar