The file system is really not suited for the type of operation you're trying to perform.
I'd suggest using a database of some sort - check out microsoft sql server express 2005 - it's free for database sizes up to 4GB, and interfaces very nicely with visual studio 2005. There's a bit of a learning curve, but the functionality payoff is well worth it.
(Our company started out logging data to the file system, and the transition to a database later rather than sooner caused alot of headaches)