壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 977|回复: 0

[Domino C/S开发] 求教版主,刷新的问题

[复制链接]
发表于 2003/10/29 17:15:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
我通过一个代理在sqlserver中找到一些数据想让它显示在简要表文档中,从工作台点击数据库图标中进来后输入一些查询条件点击一个按钮调用代理执行查询。代码如下:
程序执行的结果都是我想要的结果,现在有个问题是,第一次点击查询的按钮查询的结果能立即正确的在简要表中显示出来,但第二次点击查询按钮时显示的查询结果仍然是上次的,后台实际上结果是正确的,如果把当前窗口关闭退出到工作台在重新进去,查询的结果和显示的就一直了。这实际上是一个刷新的问题,不知各位有没有什么好的方法可以解决的。(注:应用是C/S方式的)

Sub Click(Source As Button)
        //按钮代码
        Dim uiwork As New notesuiworkspace
        Dim session As New NotesSession
        Dim na As NotesAgent
        Dim db As NotesDatabase
        Set db = session.CurrentDatabase
        Call uidoc.Save
        Set na = db.GetAgent("(getxx)")
        Call na.RunOnServer(doc.noteid)
        Call uidoc.close
        Call uiwork.EditProfile("kqxx")
End Sub


Sub Initialize
       
'        On Error Goto errors
       
        Dim db As NotesDatabase
        Dim doc As NotesDocument
        Dim docjg As notesdocument
        Dim agent As NotesAgent
        Dim session As New NotesSession
       
        Set agent = session.CurrentAgent
        Set db = session.CurrentDatabase
        'Set doc = session.DocumentContext
        Set docjg = db.getProfileDocument("kqxx")
        Set doc = db.GetDocumentByID(agent.ParameterDocID)
       
        Call docjg.remove(True)
       
        Dim connection As New ODBCConnection
        connection.ConnectTo("oadb")
       
        If Not connection.IsConnected Then
                Messagebox "连接失败,请确认数据源是否已经定义好。"
                docjg.msg = "连接失败,请确认数据源是否已经定义好。"
                Call connection.Disconnect
                Exit Sub
        End If
       
        Dim query  As New ODBCquery
        Dim result As New ODBCresultset
       
        Set query.Connection = connection
        Set result.Query = query
       
        Dim sql    As String
        Dim sName  As String '当前用户姓名
        Dim sEmpID As String '当前用户ID
        Dim startDate As String
        Dim endDate As String
       
        sName = doc.name(0)
        startDate = doc.st(0)
        endDate = doc.et(0)
       
        '先得到当前用户的EMPID       
        sql = "SELECT empid FROM HRemployee where name = '" & sName & "'"
        query.sql = sql
        Call result.execute
       
        If Not(result.IsResultSetAvailable) Then
                docjg.msg = "对不起,没有您的记录1!"
'                Goto errors
        End If
        sEmpID = result.getValue("empid")
       
        '对 kqtoday 进行汇总
        sql = "SELECT unworked = isnull(SUM( isnull(unworked,0) ),0), "
        sql = sql & " late = isnull(SUM( isnull(DATALENGTH(late),0) ),0), "
        sql = sql & " early = isnull(SUM( isnull(DATALENGTH(early),0) ),0), "
        sql = sql & " unsigned = isnull(SUM( isnull(DATALENGTH(unsigned),0) ),0), "
        sql = sql & " goout = isnull(SUM( isnull(DATALENGTH(goout),0) ),0), "
        sql = sql & " overtime = isnull(SUM( isnull(overtime,0) ),0), "
        sql = sql & " vacation = isnull(SUM( isnull(vacation,0) ),0), "
        sql = sql & " travel = isnull(SUM( isnull(travel,0) ),0) "
        sql = sql & " FROM kqtoday where empid = " & sEmpID
        sql = sql & " and ( today between '" & startDate & "' and '" & endDate & "')"
       
        query.sql = sql
        Call result.execute
       
     '得到具体数据
        sql = "select today,morning,afternoon,evening,memos from kqtoday "
        sql = sql & " where empid = " & sEmpID
        sql = sql & " and ( today between '" & startDate & "' and '" & endDate & "') "
        sql = sql & " order by today desc"
        query.sql = sql
        Call result.execute
       
        If Not(result.IsResultSetAvailable) Then
                docjg.msg = "对不起,没有您的记录!"
        '        Goto errors
        End If
       
        Dim rtitem As Variant
        Dim msgb As String
        Dim firstName As String
        Do
                result.nextRow
                firstName = result.getValue("today")
                msgb = msgb  & firstName & Chr(10)
        Loop Until result.IsEndOfData
       
        Set docjg = db.getProfileDocument("kqxx")
        doc.sw=Cstr(msgb)
        docjg.zw=Cstr(msgb)
        docjg.st=doc.st(0)
        docjg.et=doc.et(0)

        Call docjg.save(True,True)
       
        result.Close(DB_CLOSE)
        connection.Disconnect
       
'errors:
'        Print Error
'        result.Close(DB_CLOSE)
'        connection.Disconnect
       
End Sub
/痛哭/痛哭
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/29 22:15 , Processed in 0.012699 second(s), 16 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表