Help with deleting a file.

Discussion in 'ASP .Net' started by davem, Jul 5, 2007.

  1. davem

    davem Guest

    My mobile application needs to be able to delete the database on the mobile
    device. However if another application (such as Query Analyzer) had
    previously been connected to it, I receive an error telling me the file
    cannot be deleted due to a sharing violation. Then I need to go into
    Running Programs and manually stop the Query Analyzer to delete the
    database.

    I there a way to either unconditionally delete the database file or release
    all resources to that so that the file may be deleted programmatically?

    Ant suggestions are greatly appreciated.

    Thanks,

    Dave M.
    davem, Jul 5, 2007
    #1
    1. Advertising

  2. Hello davem,

    how this relates to the ASP.NET?

    To perform you task gracefully, you need to get the filehandler and enumerate
    all processes, comparing the filehandler belonging to the current process'
    filehandlers. And when the desired process will be found - kill process.
    This task relates to diving to the unmanaged world, even deeper, using undocumented
    NT functions (goole to find the sample I provided how to do this)


    ---
    WBR, Michael Nemtsev [.NET/C# MVP].
    My blog: http://spaces.live.com/laflour
    Team blog: http://devkids.blogspot.com/

    "The greatest danger for most of us is not that our aim is too high and we
    miss it, but that it is too low and we reach it" (c) Michelangelo

    d> My mobile application needs to be able to delete the database on the
    d> mobile device. However if another application (such as Query
    d> Analyzer) had previously been connected to it, I receive an error
    d> telling me the file cannot be deleted due to a sharing violation.
    d> Then I need to go into Running Programs and manually stop the Query
    d> Analyzer to delete the database.
    d>
    d> I there a way to either unconditionally delete the database file or
    d> release all resources to that so that the file may be deleted
    d> programmatically?
    d>
    d> Ant suggestions are greatly appreciated.
    d>
    d> Thanks,
    d>
    d> Dave M.
    d>
    Michael Nemtsev, Jul 5, 2007
    #2
    1. Advertising

  3. davem

    davem Guest

    Michael,

    My apologies for inadvertently posting to the wrong group not once but twice
    (been that kind of day).
    But I do appreciate you taking the time to reply.

    Thanks,

    Dave M.


    "Michael Nemtsev" <> wrote in message
    news:...
    > Hello davem,
    >
    > how this relates to the ASP.NET?
    >
    > To perform you task gracefully, you need to get the filehandler and
    > enumerate all processes, comparing the filehandler belonging to the
    > current process' filehandlers. And when the desired process will be
    > found - kill process.
    > This task relates to diving to the unmanaged world, even deeper, using
    > undocumented NT functions (goole to find the sample I provided how to do
    > this)
    >
    >
    > ---
    > WBR, Michael Nemtsev [.NET/C# MVP]. My blog:
    > http://spaces.live.com/laflour
    > Team blog: http://devkids.blogspot.com/
    >
    > "The greatest danger for most of us is not that our aim is too high and we
    > miss it, but that it is too low and we reach it" (c) Michelangelo
    >
    > d> My mobile application needs to be able to delete the database on the
    > d> mobile device. However if another application (such as Query
    > d> Analyzer) had previously been connected to it, I receive an error
    > d> telling me the file cannot be deleted due to a sharing violation.
    > d> Then I need to go into Running Programs and manually stop the Query
    > d> Analyzer to delete the database.
    > d> d> I there a way to either unconditionally delete the database file or
    > d> release all resources to that so that the file may be deleted
    > d> programmatically?
    > d> d> Ant suggestions are greatly appreciated.
    > d> d> Thanks,
    > d> d> Dave M.
    > d>
    >
    davem, Jul 5, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis Esteban Valencia Muñoz
    Replies:
    3
    Views:
    1,391
    Scott Allen
    Jun 4, 2005
  2. Harry Barker
    Replies:
    2
    Views:
    504
    Alf P. Steinbach
    Apr 19, 2006
  3. Lise
    Replies:
    3
    Views:
    139
    Aaron Bertrand [SQL Server MVP]
    Jun 8, 2006
  4. Markus Hänchen

    Perl not deleting file content if file on server

    Markus Hänchen, Jul 24, 2006, in forum: Perl Misc
    Replies:
    3
    Views:
    131
    Peter J. Holzer
    Jul 24, 2006
  5. crea
    Replies:
    2
    Views:
    397
    Nobody
    Dec 28, 2012
Loading...

Share This Page