Hi everyone!
I'm having problem in my codes, i don't know if how will i know how many records my query got. Because I'm planning to use it to set the maximum property of the progress bar. Hope you can help me on this. Thanks.
Please see my codes below:
Imports
System.Data.OleDb
Public
Class frmClean
Private Sub btnCleanUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCleanUp.Click
Dim accConn As OleDb.OleDbConnection
Dim accRec As OleDbDataReader
Dim accComm As OleDbCommand
accConn =
New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\IRM\PCCW\MIGRATION\ACCPAC TO DSMP\ACCPAC to DSMP.mdb;Persist Security Info=False")
accConn.Open()
accComm = accConn.CreateCommand()
accComm.CommandText =
"Select * From tblUnifiedAD"
MessageBox.Show(accComm.ExecuteNonQuery)
accRec = accComm.ExecuteReader
pbar.Minimum = 1
pbar.Maximum = ???? <Should be the record count of my query>
pbar.Value = 1
pbar.Step = 1
Do While accRec.Read
...Some codes here.....
pbar.PerformStep()
Loop
accConn.Close()
End Sub
End
Class
Hope you can help me on this...
Thanks a lot!
Reivax
Enter your message below
Sign in or Join us (it's free).