PHP كود :
Dim dbpath As String = IO.Path.GetDirectoryName(Application.ExecutablePath) & "\db.accdb"
Dim str As String = "provider=microsoft.ace.oledb.12.0;data source=" & dbpath
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim con As New OleDb.OleDbConnection(str)
Dim cm As New OleDb.OleDbCommand("", con)
cm.CommandText = "select Top 2 * from tb1 order by tid desc"
Dim dt As New DataTable
If con.State = ConnectionState.Closed Then con.Open()
dt.Load(cm.ExecuteReader)
If dt.Rows.Count > 0 Then
Dim rowindex As Integer = dt.Rows.Count - 1
TextBox1.Text = dt.Rows(rowindex).Item(1) & " - " & dt.Rows(rowindex).Item(2)
End If
dt.Clear()
If con.State = ConnectionState.Open Then con.Close()
End Sub
عدل ما يلزم ليعمل معك
طيب ما رايك بهذا؟
PHP كود :
PHP كود :
Dim dbpath As String = IO.Path.GetDirectoryName(Application.ExecutablePath) & "\db.accdb"
Dim str As String = "provider=microsoft.ace.oledb.12.0;data source=" & dbpath
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Clear()
Dim con As New OleDb.OleDbConnection(str)
Dim cm As New OleDb.OleDbCommand("", con)
cm.CommandText = "select top 1 * from tb1 where degree<(select top 1 degree from tb1 order by tid desc) order by tid desc"
Dim dr As OleDb.OleDbDataReader
If con.State = ConnectionState.Closed Then con.Open()
dr = cm.ExecuteReader
If dr.HasRows Then
If dr.Read Then
TextBox1.Text = dr(1) & " - " & dr(2)
End If
End If
If con.State = ConnectionState.Open Then con.Close()
dr.Close()
اللهم إني أعوذ بك من غلبة الدين وغلبة العدو، اللهم إني أعوذ بك من جهد البلاء ومن درك الشقاء ومن سوء القضاء ومن شماتة الأعداء
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير

