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. General Programming
  3. C#
  4. File Locking

File Locking

Scheduled Pinned Locked Moved C#
databasesysadminhardwarequestion
4 Posts 3 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
    scotlandc
    wrote on last edited by
    #1

    Hi everyone, I need to know how I can lock a file if someone else is using it. Briefly, I have an application which allows users to view pieces of mpg (each has a unique ID) and attach relevant data to it - a translation if needed, brand/product info etc - and then saves the whole item (mpg + metadata) to a database including the path to the now-archived mpg. The mpgs are played by clicking the appropriate row in a datagrid control which launches the mpg in a form with a media player control embedded into it. The thing is, I need to be able to somehow lock an mpg so that if user A is busy with it then user B can not begin work on it at the same time. All of the mpgs are stored on a central holding server which may have up to 20 people connected to it at any one time. When a user goes to enter the mpg information, the initial media player window closes and transfers them to a data entry screen. This holds the unique name in view but its only existent on the form at this point, not on a database. Can this be done? Sorry if I waffled, just wanted to give as much info as possible. Cheers everyone Scott

    L 1 Reply Last reply
    0
    • S scotlandc

      Hi everyone, I need to know how I can lock a file if someone else is using it. Briefly, I have an application which allows users to view pieces of mpg (each has a unique ID) and attach relevant data to it - a translation if needed, brand/product info etc - and then saves the whole item (mpg + metadata) to a database including the path to the now-archived mpg. The mpgs are played by clicking the appropriate row in a datagrid control which launches the mpg in a form with a media player control embedded into it. The thing is, I need to be able to somehow lock an mpg so that if user A is busy with it then user B can not begin work on it at the same time. All of the mpgs are stored on a central holding server which may have up to 20 people connected to it at any one time. When a user goes to enter the mpg information, the initial media player window closes and transfers them to a data entry screen. This holds the unique name in view but its only existent on the form at this point, not on a database. Can this be done? Sorry if I waffled, just wanted to give as much info as possible. Cheers everyone Scott

      L Offline
      L Offline
      Le centriste
      wrote on last edited by
      #2

      One thing you could do is put a flag in the DB to indicate that an MPG is in use and prevent other users from modifying it. This should if you can modify the database schema (like adding a column to a table).

      ----- If atheism is a religion, then not collecting stamps is a hobby. -- Unknown

      S 1 Reply Last reply
      0
      • L Le centriste

        One thing you could do is put a flag in the DB to indicate that an MPG is in use and prevent other users from modifying it. This should if you can modify the database schema (like adding a column to a table).

        ----- If atheism is a religion, then not collecting stamps is a hobby. -- Unknown

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

        Hi Le Centriste, Thanks very much for the suggestion but the way the DBA here controls his database borders on the psychotic. By the time he considers the request and then (if?) actually actions it, I'd hope to be able to achieve the same thing programatically... Any more ideas anyone? Scotty

        A 1 Reply Last reply
        0
        • S scotlandc

          Hi Le Centriste, Thanks very much for the suggestion but the way the DBA here controls his database borders on the psychotic. By the time he considers the request and then (if?) actually actions it, I'd hope to be able to achieve the same thing programatically... Any more ideas anyone? Scotty

          A Offline
          A Offline
          Amar Chaudhary
          wrote on last edited by
          #4

          save it to XML or in a new table in data base With reference of the file and a flag of file usage check it every time user tries to access the file (and don't forget to cleanup after user finished working )

          Regards Amar Chaudhary

          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