Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed Consideration
Message
 
To
All
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Title:
Speed Consideration
Miscellaneous
Thread ID:
00395221
Message ID:
00395221
Views:
39
Hi all!

im working on a project that uses a *.dbf file for its table. my concern is, is there anyway i can speed up the recordset access from the free table? i used SQL statement already instead of the sort,filter method and yet it takes me about 2mins just to bring up the form that displays the data from the remote table.

im sure there is a better and faster way to access the recordset using ADO, and anyone who can help me with it, that would really be great!

here is a sample source code of what i did...

'--------------------
Private Sub Form_Load()

Dim sLastName As String, _
sFirstName As String, _

Dim sEmpName As String, _
sDateEmp As String, _
sCurPos As String, _
sDept As String, _
sStat As String, _
sEmpNo1 As String, _
sAccnt As String, _
sSSS As String, _
sPIbig As String, _
sTIN As String

'================================
'Declare our connection variables
'always a good practice ;)
'================================
Dim adoEmpFile As New ADODB.Connection, _
rsEmpFile As New ADODB.Recordset, _
cmdEmpFile As New ADODB.Command, _
strconn As String, _
sqlconn As String, _
sEmpNo As String


'Declare constants
sEmpNo = frmLoginEmp.txtempno.Text
strconn = "DSN=sysfilesdsn;uid=;pwd="
adoEmpFile.Open strconn

'Connect to the recordset
Set cmdEmpFile.ActiveConnection = adoEmpFile
cmdEmpFile.CommandText = "SELECT * FROM empfile WHERE empno = '" & sEmpNo & "'"
rsEmpFile.CursorLocation = adUseClient
rsEmpFile.Open cmdEmpFile, , adOpenKeyset, adLockOptimistic


'Display Employee Details in sequence
Frame1.Visible = True
Frame2.Visible = False
Frame3.Visible = False
Frame4.Visible = False

'===============================
'Employement Record
sEmpName = Trim(sLastName) + ", " + Trim(sFirstName)
sDateEmp = rsEmpFile!datehired
sCurPos = rsEmpFile!Position
sDept = rsEmpFile!deptcode
sStat = rsEmpFile!cstatus
sEmpNo1 = rsEmpFile!empno
sAccnt = rsEmpFile!acctno
sSSS = rsEmpFile!sss
sPIbig = rsEmpFile!pibig
sTIN = rsEmpFile!tin

'Trim
txtempname.Text = Trim(sEmpName)
txtdateemp.Text = Trim(sDateEmp)
txtcurpos.Text = Trim(sCurPos)
txtdept.Text = Trim(sDept)
txtstat.Text = Trim(sStat)
txtempno1.Text = Trim(sEmpNo1)
txtaccnt.Text = Trim(sAccnt)
txtsss.Text = Trim(sSSS)
txtpibig.Text = Trim(sPIbig)
txttin.Text = Trim(sTIN)



'Close connection
rsEmpFile.Close
adoEmpFile.Close


End Sub


Thanks! hope to receieve replies!
**elinore**
---------------------
"The most powerful weapon on earth,
is the human soul on fire" - Ferdinand Foch
Next
Reply
Map
View

Click here to load this message in the networking platform