Need suggestions of storing data.
Posted on 2002-03-16
My application is meant to store all the windows that are open (their name, hwnd, parenthwnd, time opened at, and time closed at).
Now, I have an access database with a table called "WinLog" to store this data.
Now, ever second, my application checks through all the open windows. For each window the program checks if the window has been logged in the "WinLog" table, if it has not been logged than it is added with the ClosedAt field empty. When the list of windows has been traversed and a record in the database has not been met that has its ClosedAt time empty is changed to the current time (to indicate that the window was just closed).
This procedure takes to much resources. I believe, that the database connection might be slowing this down since for each window the following function is called:
function WindowNotYetLogged(byval WindName as string)
sqlstr = "SELECT * FROM WinLog WHERE WindowName = '" & WindName & "'"
set rs = db.openrecordset(sqlstr,dbopendynaset)
if .eof then
WindowNotYetLogged = True
Now, does anyone have a suggestion in which I can optimize this? either, by a different storage method (for example text files? or something else). Or a different algorithm to filing the data?
Also, is it professional to have a ms access database? This product will be released as a off the shelf package and not tailor-made. So, is there a more professional way of storing data?