Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. problem while reading an appending file in asp.net 2005

problem while reading an appending file in asp.net 2005

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasesysadminhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sanjubaba
    wrote on last edited by
    #1

    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

    I 1 Reply Last reply
    0
    • S sanjubaba

      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

      I Offline
      I Offline
      Ian McCaul
      wrote on last edited by
      #2

      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.

      S 1 Reply Last reply
      0
      • I Ian McCaul

        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.

        S Offline
        S Offline
        sanjubaba
        wrote on last edited by
        #3

        no its a row by row insert. the file is getting appended continuously. i am reading it with a streamreader. i am continuing reading from the file with the help of a byte count.

        Sandeep Kumbhar

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups