久久―日本道色综合久久,亚洲欧美精品在线,狼狼色丁香久久婷婷综合五月,香蕉人人超,日本网站黄,国产在线观看不卡免费高清,无遮挡的毛片免费

2023信創(chuàng)獨(dú)角獸企業(yè)100強(qiáng)
全世界各行各業(yè)聯(lián)合起來(lái),internet一定要實(shí)現(xiàn)!

VB6+ADO+ListView數(shù)據(jù)庫(kù)分頁(yè)顯示

2004-02-13 eNet&Ciweek

  Private Sub Form_Unload(Cancel As Integer)

  If rs.State = 1 Then rs.Close

  If link1.State = 1 Then link1.Close

  Set rs = Nothing: Set link1 = Nothing

  End Sub  

  Private Sub list1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) '切換表

  On Error Resume Next

  If list1.ListItems.Count = 0 Then Exit Sub

  If rs.State = 1 Then rs.Close

  list2.ListItems.Clear: list2.ColumnHeaders.Clear: c.Clear

  rs.Open "select * from " & list1.SelectedItem.Text, link1, adOpenStatic, adLockReadOnly

  If Err.Number <> 0 Then

  MsgBox "該數(shù)據(jù)表不能支持的游標(biāo)模式", vbCritical, "不規(guī)則的格式": Exit Sub

  End If

  rs.PageSize = Text1.Text

  rslen = rs.RecordCount

  If rs.PageCount < page Then page = 1

  Label3.Caption = "共" & rslen & "條記錄,共" & rs.PageCount & "頁(yè),當(dāng)前頁(yè)碼 " & page

  If rs.PageCount > page Then down.Enabled = True Else down.Enabled = False

  If page <> 1 Then up.Enabled = True Else up.Enabled = False

  Set ziduan = rs.Fields '定義字段記錄集

  For i = 0 To ziduan.Count - 1

  list2.ColumnHeaders.Add , , ziduan(i).Name '根據(jù)字段指定視圖列

  c.AddItem ziduan(i).Name

  rs.MoveFirst '記錄到尾后填充下一列

  rs.AbsolutePage = page '定義記錄集的絕對(duì)頁(yè)碼

  For r = 0 To rs.PageSize - 1

  If rs.EOF Then Exit For

  rstext = rs(i)

  If i = 0 Then '首次直接填充第一列

  list2.ListItems.Add , , rstext

  Else '非首次填充下一下

  If rstext <> Empty Then list2.ListItems(r + 1).ListSubItems.Add , , rstext Else list2.ListItems(r + 1).ListSubItems.Add , , ""

  End If

  rs.MoveNext

  Next

  Next

  If c.ListCount <> 0 Then c.ListIndex = 0: findstr.Enabled = True Else findstr.Enabled = False

  Set ziduan = Nothing

  End Sub  

  Private Sub menu01_Click(Index As Integer)

  Select Case Index

  Case 1: '建新表演示

  str1 = 1

  For i = 1 To list1.ListItems.Count

  If InStr(list1.ListItems(i).Text, "新建表") = 1 Then str1 = str1 + 1

  Next

  link1.Execute "create table 新建表" & str1 & "(會(huì)員名 Text,密碼 Varchar(8),年齡 int not null,經(jīng)驗(yàn)值 " & _

  "integer,加入日期 DateTime null)"

  link1.Execute "insert into 新建表" & str1 & "(會(huì)員名,密碼,年齡,經(jīng)驗(yàn)值,加入日期) values ('風(fēng)云舞','12345678'" & _

  ",18,365,'" & Now & "')"

  link1.Execute "insert into 新建表" & str1 & "(會(huì)員名,密碼,年齡,經(jīng)驗(yàn)值,加入日期) values ('Lshdic','87654321'" & _

  ",18,365,'" & Now & "')"

  opendatabase pubdatapath '刷新重裝載列表

  Case 2: '刷新——重裝載

  opendatabase pubdatapath

  Case 3: '刪除

  If rs.State = 1 Then rs.Close

  link1.Execute "Drop table " & list1.SelectedItem.Text

  opendatabase pubdatapath

  Case 4: '表屬性

  If rs.State = 1 Then rs.Close

  rs.Open "select * from " & list1.SelectedItem.Text, link1, adOpenStatic, adLockReadOnly

  For i = 0 To rs.Fields.Count - 1

  str1 = str1 & rs.Fields(i).Name & ","

  str2 = str2 & rs.Fields(i).Type & ","

  str3 = str3 & rs.Fields(i).ActualSize & ","

  str4 = str4 & rs.Fields(i).DefinedSize & ","

  Next

  MsgBox "包含字段:" & str1 & vbCrLf & vbCrLf & "字段類型:" & str2 & vbCrLf & vbCrLf & "第一行數(shù)據(jù)大小:" & _

  str3 & vbCrLf & vbCrLf & "每行數(shù)據(jù)預(yù)設(shè)容量:" & str4, vbExclamation, "表屬性"

  End Select

  End Sub  

  Private Sub Text2_GotFocus()

  If Text2.Text = "查找關(guān)鍵字..." Then Text2.Text = ""

  End Sub  

  Private Sub Text2_LostFocus()

  If Text2.Text = "" Then Text2.Text = "查找關(guān)鍵字..."

  End Sub  

  Private Sub up_Click() '功能,上一頁(yè)

  page = page - 1: list1_MouseUp 1, 0, 10, 10

  End Sub(完)

相關(guān)頻道: eNews

您對(duì)本文或本站有任何意見(jiàn),請(qǐng)?jiān)谙路教峤唬x謝!

投稿信箱:tougao@enet16.com