Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6168753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:44:35+00:00 2026-05-23T22:44:35+00:00

I am developing a c# application, backend as sqlite.In my application i have an

  • 0

I am developing a c# application, backend as sqlite.In my application i have an option for clean databse.It means the curren .db file will delete using File.Delete method and again it create empty databse using File.create method.Now let me explain the problem.

To perform cleandatabse task, i have to stop all the process which is running ,after doing that if i click on clean database it is throwing an error that file cannot delete, it is being used by another process.i am able to stop all the thread which is running.

Somehow i am able to find which process is blocikng the file ,

foreach (var process in Process.GetProcesses()) {
                var files = GetFilesLockedBy(process);
                if (files.Contains(filePath))
                {
                    procs.Add(process);
                    Console.WriteLine(process.ProcessName);
                    process.Kill();
                    File.Delete(filePath);
                }
            }

But in the above code i used process.Kill, which close the window form which i am running.
without using kill, i tried close and dispose which doesn’t work for me.

Can you please help me to release the file from the process without closing the application and then yo delete the db file.

Thank you in advance

Best regards

Sangita.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:44:36+00:00Added an answer on May 23, 2026 at 10:44 pm

    You should make sure you close every stream you open it:

    using (Stream str = File.Create("C:\\h.txt"))
    {
    // your code here
    } // the stream will be automatically closed here
    

    if you don’t put this using statement, it will cause you a lot of bugs, even if you close it manually str.Close();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an Android application using SQLite as backend. I want to make
I'm currently developing a PHP application that's using an Access database as a backend.
im a novice into developing an application using backend as Python (2.5) and Qt(3)
I am currently developing an application using C# and a MySQL Database Backend. My
I am developing c# application with a backend sqlite db. In my application mutithreaded
I am developing c# application , in which the backend is sqlite. multiple threads
I'm developing application WinForms .net 4.0 using C# and the backend is SQL Server
I am developing a windows application and using Postgres as backend database. At some
I'm developing a timesheet application using SQL Server as my backend and I am
I'm developing a iPhone application that will use a Google App Engine backend and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.