| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 368 人关注过本帖
标题:就这个程序如何到分页显示
只看楼主 加入收藏
jsyyqyyq
Rank: 1
等 级:新手上路
帖 子:21
专家分:7
注 册:2011-12-21
结帖率:50%
收藏
 问题点数:0 回复次数:0 
就这个程序如何到分页显示
我的查询程序如下  一页现在是1000  要让其一页显示100
Private Sub Command2_Click()
    On Error GoTo 0
   


    Dim sPro, sSer, sCon, sDsn, DSNName
    Dim conn1, oRs1, oCom1, sSql1, m, conn2, oRs2, oCom2, sSql2
'     Dim conn1, oRs1, oCom1, sSql1, m,
    Dim oList, oItem, i, j

     Dim WinCC As Object
    Set WinCC = CreateObject("WinCC-Runtime-Project")
    Dim database
    database = WinCC.GetValue("@DatasourceNameRT")

   
    sPro = "Provider=WinCCOLEDBProvider.1;"
    sDsn = "Catalog= " & database & ";"
    sSer = "Data Source=.\WinCC;User ID=sa;"
    sCon = sPro & sDsn & sSer
   
    Text1.Text = DateAdd("h", -8, DTPicker1)
    Text2.Text = DateAdd("h", -8, DTPicker2)
   
'    sSql = "TAG:R,('PV\F1';'PV\F2'),'" & Text1.Text & "','" & Text2.Text & "'"
   
   sSql1 = "TAG:R,('PV\F1'),'" & Text1.Text & "','" & Text2.Text & "'"
   sSql2 = "TAG:R,('PV\F2'),'" & Text1.Text & "','" & Text2.Text & "'"
    Set conn1 = CreateObject("ADODB.Connection")
        conn1.ConnectionString = sCon
        conn1.CursorLocation = 3
        conn1.Open
    Set oRs1 = CreateObject("ADODB.Recordset")
    Set oCom1 = CreateObject(")
         = 1
    Set oCom1.ActiveConnection = conn1
         = sSql1
    Set oRs1 = oCom1.Execute
   
    Set conn2 = CreateObject("ADODB.Connection")
        conn2.ConnectionString = sCon
        conn2.CursorLocation = 3
        conn2.Open
    Set oRs2 = CreateObject("ADODB.Recordset")
    Set oCom2 = CreateObject(")
         = 1
    Set oCom2.ActiveConnection = conn2
         = sSql2
    Set oRs2 = oCom2.Execute
   
    flex2.Clear
    If (Not oRs1.EOF) Then
        oRs1.MoveFirst
      
        i = 1
           Do While Not oRs1.EOF
                flex2.TextMatrix(i, 1) = i
                flex2.TextMatrix(i, 2) = DateAdd("h", 8, oRs1.Fields(1).Value)
                flex2.TextMatrix(i, 3) = CStr(oRs1.Fields(2).Value)
                flex2.TextMatrix(i, 4) = CStr(oRs2.Fields(2).Value)
        

                oRs1.MoveNext
                oRs2.MoveNext
                i = i + 1
        Loop
            oRs1.Close
            oRs2.Close
            
    End If
  

    Set oRs1 = Nothing
    Set oCom1 = Nothing
    Set conn1 = Nothing
    Set oRs2 = Nothing
    Set oCom2 = Nothing
    Set conn2 = Nothing
   
End Sub

Private Sub flex2_Click()

End Sub

Private Sub Form_Activate()
flex2.Rows = 1000
  flex2.Cols = 5

  '设置列标头。
  s$ = "^|^序号  |^        时间           |^       压力        |^     温度     "
  flex2.FormatString = s$
End Sub

Private Sub Form_Load()

End Sub
搜索更多相关主题的帖子: database Object 
2012-12-24 12:45
快速回复:就这个程序如何到分页显示
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017913 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved