hi guys,
i need some help with a database issue ...
i have a module - Sub A - which opens a database and imports a text file
into the database, - while the database is open it calls module -Sub B which
also needs the same database and extracts data to a text file.
following is the psuedo code
sub A
create object called objconnection
create object called varconnection
set objrecordset
set varrecordset
open objconnection
open varconnection
objrecordset.open (select * from table)
varrecordset.open (select specific field from table)
create filesystemobject
start a recursive search for txt files
store the file paths and parent folder in vardatabase
do until end of text files
go to the first text file and open for reading
read the lines and store in objdatabase (when you meet a "tab" put into
next field)
update the recordset
call sub B with path to file
move to next text file
close objconnection,varconnection,objrecordset,varrecordset
End Sub A
Sub B
objectconnection to database1
objectrecordset.open select table.field from table1 where value.table1 =
value.table2
objectFSO
open file for appending
select the fileds from the database
write to file in the given path
close recordset and connection and fso.
End Sub B
if i run this on 1 file then its fine ... but when i tried it on 30+ files
it slowed down and missed some lines in the text files and didn't even create
some text files ... i'm lost as to what is going on ... my best guess is that
i've created too many connections to database and files and they are not
opening and closing in time for the next process therefore misses things out
... anybody have any idea how i can sort this issue out...
thanks,