添加信息的那个窗口是用ADODC的,来添加进去的,那个显示信息的窗口是用数据环境设计器一个命令来显示它的,只能重新运行才行的,如果我想同步,那怎么办啊?谢谢先!

解决方案 »

  1.   

    关闭信息窗口时
    Adodc1.Refresh
      

  2.   

    我忘了说,我不是用ADODC控件,我是引用ADODC控件,呵呵,那怎么办啊?有没有这种说法的啊
      

  3.   

    Private Sub CmdOK_Click()
    Dim Mycon As New ADODB.Connection
    Dim Myrec As New ADODB.Recordset
    Dim strSQL As String, strConn As String, strSQL2 As String
    If txtName = "" Or txtID = "" Then
        MsgBox "注意,系别名或系别编号不能为空!", vbExclamation, " 提示"
        txtName.SetFocus
    Else
        strSQL2 = "select * from Department where Name='" & txtName.Text & "'"
        strSQL = "insert into Department values('" & txtID & "','" & txtName & "')"
        strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Password=;Data Source="
        strConn = strConn & App.Path & "\Student.mdb" & ";Persist Security Info=True"
        Mycon.ConnectionString = strConn
        Mycon.Open
        Myrec.CursorLocation = adUseClient
        Myrec.Open strSQL2, Mycon, adOpenKeyset, adLockPessimistic, adCmdText
        If Myrec.RecordCount = 0 Then
            Mycon.Execute strSQL
            
            
            MsgBox "你已经成功添加了一条系别信息!", vbInformation, " 提示"
            txtName.Text = ""
        
            txtID.Text = ""
            txtName.SetFocus
        Else
            MsgBox "此信息已存在!", vbInformation + vbOKOnly, " 提示"
            Unload Me
            frmClassInsert.Show 1
        End IfEnd If
        
    End Sub
    那怎么更新呢,求你们帮我一下!
      

  4.   

    我那个窗体也是在LOAD事件中重新绑定了啊