problem while reading an appending file in asp.net 2005
-
hi, i have a txt file which is getting updated with records on a server. I am reading the file using a streamreader and filestream, by mapping the drive of the server where the file is getting appended, using asp.net 2005. i am using the following code: StreamReader reader= new StreamReader(new FileStream(sfilepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 8, FileOptions.Asynchronous)); reader is then passed to a bulkinsert method which inserts the records one by one in the database. Problem is, sometime duplicate entries gets inserted in the database, but actualy the txt file does not contain duplicate entries.
Sandeep Kumbhar
-
hi, i have a txt file which is getting updated with records on a server. I am reading the file using a streamreader and filestream, by mapping the drive of the server where the file is getting appended, using asp.net 2005. i am using the following code: StreamReader reader= new StreamReader(new FileStream(sfilepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 8, FileOptions.Asynchronous)); reader is then passed to a bulkinsert method which inserts the records one by one in the database. Problem is, sometime duplicate entries gets inserted in the database, but actualy the txt file does not contain duplicate entries.
Sandeep Kumbhar
Is this being done as a transaction or just row by row inserts? You could always try to run a select for that record in the db before you decide to insert it.
-
Is this being done as a transaction or just row by row inserts? You could always try to run a select for that record in the db before you decide to insert it.