[翻问题解决了]
vb吧
全部回复
仅看楼主
level 9
Option ExplicitPublic appdisk As StringPublic conn As New ADODB.ConnectionPublic Rs As New ADODB.RecordsetPublic db As StringPrivate sSQL As StringPrivate iPage As IntegerPrivate Sub cmdNext_Click() If iPage + 1 = Rs.PageCount Then Rs.AbsolutePage = Rs.PageCount Else Rs.AbsolutePage = iPage + 1 iPage = iPage + 1 End IfEnd SubPrivate Sub Command1_Click() If iPage - 1 = 0 Then Rs.AbsolutePage = iPage Else Rs.AbsolutePage = iPage - 1 iPage = iPage - 1 End IfEnd SubPrivate Sub Form_Load() iPage = 1 Dim i As Integer On Error GoTo Err appdisk = Trim(App.Path) If Right(appdisk, 1) <> "\" Then appdisk = appdisk & "\" db = appdisk db = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & db & "db1.mdb" conn.CursorLocation = adUseClient conn.Open db Rs.Open "select * from pump4", conn, adOpenDynamic, adLockOptimistic Rs.PageSize = 10 Set DataGrid1.DataSource = Rs DataGrid1.Columns(0).Width = 15 * 7 * 3 DataGrid1.Columns(1).Width = 15 * 7 * 10 DataGrid1.Columns(2).Width = 15 * 7 * 8 DataGrid1.Columns(3).Width = 15 * 7 * 7 DataGrid1.Columns(4).Width = 15 * 7 * 7 DataGrid1.Columns(5).Width = 15 * 7 * 7 DataGrid1.Columns(6).Width = 15 * 7 * 7 DataGrid1.Columns(7).Width = 15 * 7 * 7 DataGrid1.Columns(8).Width = 15 * 7 * 7 DataGrid1.Columns(9).Width = 15 * 7 * 7 DataGrid1.Columns(10).Width = 15 * 7 * 7 DataGrid1.Columns(11).Width = 15 * 7 * 9 DataGrid1.Columns(12).Width = 15 * 7 * 9 DataGrid1.Columns(13).Width = 15 * 7 * 9 DataGrid1.Columns(14).Width = 15 * 7 * 10 Exit SubErr: MsgBox Err.Number Unload MeEnd Sub
2008年08月21日 12点08分 1
level 9
有个bugIf iPage + 1 = Rs.PageCount Then 改成If iPage + 1 = Rs.PageCount + 1 Then
2008年08月21日 13点08分 2
level 12
应该从SQL语句上进行优化啊.这样,服务器还是一次得到所有的记录了.没有减压.只是在显示层实现了分页
2008年08月21日 13点08分 3
level 0
楼上,通过sql分页,不具有通用性,特别是任意字段排序,组合排序等情况,很难通过sql分页,
2008年08月21日 13点08分 4
level 0
ggggdiu 我也想通过sql语句来排序 但是你能告诉我access中怎么来分页吗?会飞的青蛙
2008年08月22日 00点08分 5
level 0
这个问题不是给sql减压的问题 而是用access和datagrid怎么来进行分页 呵呵!~
2008年08月22日 00点08分 6
level 12
关注点不同吧,如果只是为了用datagrid来分页,这个方式是最好的了.不过我从不用datagrid这种绑定式风格的网格控件的.太不灵活了.在NET下也是如此. access分页还真没有研究过,一般我用SQL SERVER 或 ORACLE,单机的我用SQLLITE,比ACCESS要绿和好用一点.
2008年08月22日 01点08分 7
level 0
呵呵!~ sqlserver和oracle做分页都很简单 拿sql语句直接可以搞定昨天有人问access中怎么办 我只好这么弄了!~我也是昨天才找到怎么弄得!~
2008年08月22日 01点08分 8
1