首 页文章中心下载中心繁體中文
设为首页
加入收藏
联系我们
您当前的位置:开源盛世-源代码下载网 -> 文章中心 -> V B 专区 -> 文章内容 退出登录 用户管理
投票调查
栏目导航
· VC++专区 · V B 专区
· GIS 专区 · PDA 专区
· 其他编程 · 网站开发类
· 数据库类 · 软件应用
· 网络安全 · 论文专区
· 综合资讯
热门文章
· Tab Control控件使用...
· 学生档案管理系统
· [图文] 排列组合公式
· UTF-8与GB2312之间的...
· DirectShow下载安装...
· Virtual PC 在PAE模...
· Windows2000终端服务...
· MapInfo上的GIS系统...
· kalman filter 卡尔...
· Windows2000终端服务...
相关文章
数据在窗体中的翻页
作者:佚名  来源:vscodes.com整理  发布时间:2005-12-16 13:46:22  发布人:Polaris

减小字体 增大字体

用mshflexgrid控件实现数据库翻页
========================
打开vb6.0
在窗体中加入2个command控件,1个mshflexgrid控件
代码:
-----------------------------
Dim intpage As Integer

Private Sub Command1_Click()
intpage = intpage - 1
page intpage
End Sub

Private Sub Command2_Click()

intpage = intpage + 1
page intpage
End Sub

 Sub page(intpagecount As Integer)
On Error Resume Next
Dim cn As New ADODB.Connection
Dim cm As New ADODB.Command
Dim rs As New ADODB.Recordset
MSHFlexGrid1.Clear
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & App.Path & "Students.mdb"
cn.Open
cm.ActiveConnection = cn
rs.CursorLocation = adUseClient
rs.Open "select * from 新生入学信息表 ", cn, adOpenDynamic, adLockBatchOptimistic
rs.PageSize = 10
If intpagecount > rs.PageCount Then
intpagecount = rs.PageCount
End If
If intpagecount < 1 Then
intpagecount = 1
End If
rs.AbsolutePage = intpagecount

'MsgBox rs.Fields.Count
With MSHFlexGrid1
    .Cols = rs.Fields.Count
    .Rows = 10
    For i = 0 To 9
        For j = 0 To rs.Fields.Count - 1
        .TextMatrix(i, j) = rs.Fields(j)
        Next
    rs.MoveNext
    Next
End With
 End Sub

Private Sub Form_Load()
Command2.Caption = "下一页"
Command1.Caption = "上一页"
page 1
End Sub

作者主页:http://risk.y365.com


End of《数据在窗体中的翻页》

[] [返回上一页] [打 印] [收 藏]
 
∷相关“数据在窗体中的翻页”文章评论∷
(评论内容只代表网友观点,与本站立场无关!) [更多评论...]
  评论人:null   打分:0 分  发表时间:2007-2-24 13:59:23
· 你们试过成功了吗?到处贴! 
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站目录 鄂ICP备06007162
开源盛世 版权所有Copyright © 2003-2005 VSCodes.Com. All Rights Reserved.