Data flipping in the form

zhaozj2021-02-16  43

Implement the database turn page with the MSHFLExGrid control ======================== Open VB6.0 Add 2 Command Controls in the form, 1 MSHFLEXGRID control code : ---------------------------- DIM INTPAGE AS INTEGER

Private Sub Command1_Click () INTPAGE = INTPAGE - 1Page INTPAGEEND SUB

Private sub fascist2_click ()

INTPAGE = INTPAGE 1PAGE INTPAGEEND SUB

Sub page (intpagecount As Integer) On Error Resume NextDim cn As New ADODB.ConnectionDim cm As New ADODB.CommandDim rs As New ADODB.RecordsetMSHFlexGrid1.Clearcn.ConnectionString = "Provider = Microsoft.Jet.OLEDB.3.51; Persist Security Info = False ; Data Source = "& App.Path &" /Students.mdb"cn.Opencm.ActiveConnection = cnrs.CursorLocation = adUseClientrs.Open "select * from freshmen information table", cn, adOpenDynamic, adLockBatchOptimisticrs.PageSize = 10If intpagecount> rs.pagecount thenintpagecount = rs.pagecountend @ INTPAGECUNT <1 TENINTPAGECUNT = 1END IFRS.ABSOLUTEPAGE = INTPAGECUNT

'Msgbox rs.fields.countwith 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 nextend with end sub

PRIVATE SUB FORM_LOAD () Command2.caption = "Next" Command1.caption = "Previous" Page 1END SUB

Home: http://risk.y365.com

转载请注明原文地址:https://www.9cbs.com/read-27732.html

New Post(0)