Imports System.Data.OleDb
Imports System.IO
Imports System.Configuration
Imports System.Data
Imports System.Data.DataTable
Public Class Form1
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\english1.mdb")
Dim myreader11 As OleDbDataReader
Dim myreader5 As OleDbDataReader
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
End Sub
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
Dim myreader1 As OleDbDataReader
Dim strsql As String
strsql = "select id from table1 where id =(select max(id) from table1)"
Dim cmd1 As New OleDbCommand(strsql, conn)
myreader1 = cmd1.ExecuteReader
myreader1.Read()
Label2.Text = myreader1("id")
Timer2.Enabled = True
conn.Close()
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
For aa As Integer = 0 To TextBox1.Text Step 1
aa = TextBox1.Text + 1
TextBox1.Text = aa
Dim strsql As String
strsql = "select id from table1 where id=" + TextBox1.Text + ""
Dim cmd1 As New OleDbCommand(strsql, conn)
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
myreader11 = cmd1.ExecuteReader
If (myreader11.Read()) Or aa < Label2.Text Then
'Try
' TextBox1.Text = myreader1("id")
'Catch
'End Try
load1()
Else
Timer2.Enabled = False
TextBox1.Text = Label2.Text
MessageBox.Show("Words Ended")
Return
End If
Next
conn.Close()
End Sub
Private Sub load1()
Try
Dim conn5 As New OleDbConnection
conn5.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\english1.mdb")
If conn5.State = ConnectionState.Closed Then
conn5.Open()
End If
Dim strsql5 As String
strsql5 = "select * from table1 where id=" + TextBox1.Text + ""
Dim cmd5 As New OleDbCommand(strsql5, conn5)
myreader5 = cmd5.ExecuteReader
myreader5.Read()
Try
Label3.Text = myreader5("word")
Catch
End Try
Try
Label4.Text = myreader5("ar")
Catch
End Try
Try
Label5.Text = myreader5("en")
Catch
End Try
conn5.Close()
Catch
End Try
End Sub
End Class
No comments:
Post a Comment