Error - Process is used by Another Process

114 views
Skip to first unread message

Dr. Amanpreet Singh

unread,
Sep 30, 2021, 3:03:21 AM9/30/21
to firebird-n...@googlegroups.com
hi..

When I copy the file and fetch the data from the database it works fine. When I overwrite the database with command it gives the error 
firebird the process cannot access the file because it is being used by another process


Here is the Function which I used

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 Public Function getdata(ByVal Query As String) As DataTable
        Dim mds As New DataTable
        Dim MyConnectionString As String = myString
        Using connection = New FbConnection(MyConnectionString)
            Try
                connection.Open()
                Using command = New FbCommand(Query, connection)
                    Using reader = command.ExecuteReader()
                        mds.Load(reader)
                        Return mds
                    End Using
                End Using

            Catch ex As Exception
                MsgBox("DB Error", vbCritical, "")
                MsgBox(Err.Description)
                Return Nothing
            End Try
            connection.Close()
            connection.Dispose()
        End Using
    End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
dim xtable as datatable = getdata("d:\abc\dbfile", "select * from tablename")

Please anybody give me the solution

regards


Dr. Amanpreet Singh

unread,
Sep 30, 2021, 3:05:58 AM9/30/21
to firebird-n...@googlegroups.com
dim xtable as datatable = getdata("select * from tablename")    ''Correct Line

Gerdus van Zyl

unread,
Sep 30, 2021, 5:02:25 AM9/30/21
to firebird-n...@googlegroups.com
Well as the error message says the firebird process can't open the file. Alot of the time it is Antivirus that is scanning the file; in which case you can exclude the directory.
You can use a utility like https://www.nirsoft.net/utils/opened_files_view.html to see exactly what program has your file open.

--
You received this message because you are subscribed to the Google Groups "firebird-net-provider" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-net-pro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebird-net-provider/CA%2B5X22N45oQSbN3Gq1nAq1PYmEGA96nQn_VgWfCpqqm25H7w_w%40mail.gmail.com.

Mark Rotteveel

unread,
Sep 30, 2021, 5:04:53 AM9/30/21
to firebird-n...@googlegroups.com
On 30-09-2021 11:02, Gerdus van Zyl wrote:
> Well as the error message says the firebird process can't open the file.
> Alot of the time it is Antivirus that is scanning the file; in which
> case you can exclude the directory.

Instead of excluding the directory, it is better to exclude the database
file extension (e.g. .fdb) as that is more specific and doesn't prevent
the virus scanner from scanning other things that it really should scan
(e.g. executables in that same directory).

Mark
--
Mark Rotteveel
Reply all
Reply to author
Forward
0 new messages