developer155
Programmer
Hi,
i am writing an app that reads from a large file (500K + records) processes data and writes to a db.
Now along the way I query the db and write to an errro file for all records (check data and write errors). The app is slow and I am trying to improve that.
NowI open db connection once (in the beginning of app) as well as StreamWriter object to write to error file. My question is is that a correct technique or is it better to open and close db connection and streamwriter every time i need to query the db or write to a file?
thanks!
i am writing an app that reads from a large file (500K + records) processes data and writes to a db.
Now along the way I query the db and write to an errro file for all records (check data and write errors). The app is slow and I am trying to improve that.
NowI open db connection once (in the beginning of app) as well as StreamWriter object to write to error file. My question is is that a correct technique or is it better to open and close db connection and streamwriter every time i need to query the db or write to a file?
thanks!