一般,我都不喜歡做這樣報(bào)上一條下一條,太專業(yè)的數(shù)據(jù)庫操作不適合終端用戶。
成都創(chuàng)新互聯(lián)專注于額濟(jì)納網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供額濟(jì)納營銷型網(wǎng)站建設(shè),額濟(jì)納網(wǎng)站制作、額濟(jì)納網(wǎng)頁設(shè)計(jì)、額濟(jì)納網(wǎng)站官網(wǎng)定制、小程序制作服務(wù),打造額濟(jì)納網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供額濟(jì)納網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
如果必須要做,你可以這樣:按排序規(guī)則,取到健列表。保存到list中,上下條,只是改變一索引而已。
Imports System.Data.OleDb
Class BindNavigate
Dim cnn As OleDb.OleDbConnection '打開連接略
Dim lst As New List(Of Integer)
Sub New()
lst = New List(Of Integer)
index = -1
Using da As New OleDbDataAdapter("select id from mytable order by abc,def", cnn), tb As New DataTable
da.Fill(tb)
For Each row As DataRow In tb.Rows
Dim n As Integer = row(0)
lst.Add(n)
Next
If tb.Rows.Count 0 Then CurrentIndex = 0
End Using
End Sub
Dim index As Integer Event CurrentIndexChanged()
Property CurrentIndex As Integer
Get
Return index
End Get
Set(ByVal value As Integer)
Dim b As Boolean = value index
index = value
If b Then RaiseEvent CurrentIndexChanged()
End Set
End Property
'當(dāng)前的鍵值
ReadOnly Property CurrentValue As Integer
Get
Return lst(index)
End Get
End Property
Sub MoveFirst()
CurrentIndex = 0
End Sub
Sub MovePrevious()
CurrentIndex -= 1
End Sub
Sub MoveNext()
CurrentIndex += 1
End Sub
Sub MoveLast()
CurrentIndex = lst.Count - 1
End Sub
ReadOnly Property BOF
Get
Return CurrentIndex = 0
End Get
End Property
ReadOnly Property EOF
Get
Return CurrentIndex = lst.Count - 1
End Get
End Property
Private Sub Text_CurrentIndexChanged() Handles Me.CurrentIndexChanged
'綁定過程
End Sub
End Class
數(shù)據(jù)庫中記錄的存放是無序的,不存在順序問題。
如果需要順序,可在查詢語句中使用 order by 子句。
加了單引號就是一個(gè)常量字符串了,對于每一行都是一樣的
像這種放在最前面的字段,order by 1 就可以了
function Newfile as fileinfo
Dim dic As New System.IO.DirectoryInfo("C:\Users\Q\Desktop\數(shù)據(jù)")
Dim files = dic.GetFiles.OrderByDescending(Function(s) s.CreationTime)
if files.
return files.first
end function
注意引入 system.linq
Function a(s As String) As String
Dim i = s.IndexOf("/")
If i 0 Then
Return s.Substring(0, i)
ElseIf i = 0 Then '第一個(gè)字符為"/"
If s.LastIndexOf("/") 0 Then '不只一個(gè)"/"
Return s.Substring(0, s.Substring(1).IndexOf("/") + 1)
Else
Return Nothing '只有一個(gè)"/"
End If
Else '不含"/"或是空串
Return Nothing
End If
End Function
基本上不出錯(cuò)了