jkovac
February 25th, 2000, 07:12 AM
I am writing a fairly simple app that reads a text file, uses some of the information to do direct reads to a SQL database and writes out a modified text file. There is some interaction with the user through a front-end form but most of the work is done reading the database. The problem is performance. Processing 100 records takes over 3 minutes and I have to pass through over 10000 records. Here is an example of the code I use to read the database:
sSelectStmt = "SELECT price.HIGH_PRC "
sSelectStmt = sSelectStmt + "From DBA.price Where price.PRICE_DT = '" + fmtGrantDt + "'"
adoCommand.CommandText = sSelectStmt
adoRecordset.Open adoCommand, , adOpenForwardOnly, adLockReadOnly
If adoRecordset.BOF = true And adoRecordset.EOF = true then
print #3, MyRecord
else
OrigSP = adoRecordset!HIGH_PRC
adoRecordset.Close
Is there a better way to do this? I am really new at using VB and everything I read says that ADO is the most efficient way of accessing databases. The database is being accessed through ODBC DSN.
sSelectStmt = "SELECT price.HIGH_PRC "
sSelectStmt = sSelectStmt + "From DBA.price Where price.PRICE_DT = '" + fmtGrantDt + "'"
adoCommand.CommandText = sSelectStmt
adoRecordset.Open adoCommand, , adOpenForwardOnly, adLockReadOnly
If adoRecordset.BOF = true And adoRecordset.EOF = true then
print #3, MyRecord
else
OrigSP = adoRecordset!HIGH_PRC
adoRecordset.Close
Is there a better way to do this? I am really new at using VB and everything I read says that ADO is the most efficient way of accessing databases. The database is being accessed through ODBC DSN.