Foxtable(狐表)用户栏目专家坐堂 → 用OpenQQ同步数据问题


  共有2014人关注过本帖平板打印复制链接

主题:用OpenQQ同步数据问题

帅哥哟,离线,有人找我吗?
drcqh
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:326 积分:3717 威望:0 精华:0 注册:2013/1/7 17:39:00
用OpenQQ同步数据问题  发帖心情 Post By:2023/3/9 16:28:00 [只看该作者]

请教老师:我想通过如下代码实现客户端数据表的同步,但执行时没有实现同步,代码如下:

Open客户端的receivedMessage事件中的代码如下:
Dim msg As String = e.Message
If msg.StartsWith("U#") Then '表示修改了某行
    Dim pts() As String = msg.Split("#")
    If pts.Length = 3 Then
        Dim dr As DataRow = DataTables(pts(1)).Find("[_Identify] = " & pts(2))
        If dr IsNot Nothing  Then
            dr.Load() '重新加载此行
        End If
    End If
ElseIf msg.StartsWith("A#") Then '表示增加了行
    Dim pts() As String = msg.Split("#")
    If pts.Length = 3 Then
        DataTables(pts(1)).AppendLoad("[_Identify] = " &  pts(2)) '追载新增加的行.
    End If
ElseIf msg.StartsWith("D#") Then '表示删除了行
    Dim pts() As String = msg.Split("#")
    If pts.Length = 3 Then
        DataTables(pts(1)).RemoveFor("[_Identify] = "  & pts(2)) '移除行
    End If
End If



客户端项目的全局表事件AfterSaveDataRow中写入如下代码:
Dim p, msg As String
If e.StatementType = 0 Then   '新增行时
    p = "A#"
ElseIf e.StatementType = 1 Then   '修改行时
    P = "U#"
    Else    '删除行时 
    p = "D#"
End If
msg = p & e.DataTable.Name & "#" & e.DataRow("_identify")
For Each bd As qqbuddy In QQClient.Buddies
    If bd.OnLine Then
        QQClient.Send(bd.Name, msg)
    End If
Next

这个表事件不能实现同步吗

 回到顶部