Access lock file

Hi everybody,

I'm using fast-report studio 4.6.15 and the problem I'm facing now is the following.

I created a report file with a Jet 4.0 OLE DB connection to an Access database. I noticed that, when my application prints o previews the report file, the lock file (<databasename>.ldb) of the database wasn't deleted when the program quits.

Fast Report Studio itself exhibits the same behaviour. If I open a report within the editor, when the application exits the lock is not released.

Does anybody know how to fix this problem?

Thomas

Comments

  • dsydsy
    edited 4:59PM
    Vestasoft wrote: »
    Hi everybody,

    I'm using fast-report studio 4.6.15 and the problem I'm facing now is the following.

    I created a report file with a Jet 4.0 OLE DB connection to an Access database. I noticed that, when my application prints o previews the report file, the lock file (<databasename>.ldb) of the database wasn't deleted when the program quits.

    Fast Report Studio itself exhibits the same behaviour. If I open a report within the editor, when the application exits the lock is not released.

    Does anybody know how to fix this problem?

    Thomas

    Tested with vb6 sp6 - fastreport 3

    In report You don't use connection bat the TfrxADODatabase object

    Important : set login to false to avoid the login prompt

    In code section of the report insert the routine:

    sub ReportOnStartReport(Sender)
    database.connected=false
    End Sub

    to avoid the disk or lan error message


    VB6 code:

    Option Explicit
    Dim frx As FastReport.TfrxReport
    Dim db As TfrxADODatabase

    Private Sub Command1_Click()
    Dim connString As String
    Call initFastreport

    ' if you must print two reports together
    Call preview(App.Path + "\provadb.fr3", True, false)
    Call preview(App.Path + "\provadb1.fr3", False, True)

    ' if you print one report
    Call preview(App.Path + "\provadb.fr3", True, True)

    Call closeFastreport

    End Sub

    Private Sub initFastreport()
    Set frx = CreateObject("FastReport.TfrxReport")
    End Sub

    Private Sub closeFastreport()
    Set frx = Nothing
    End Sub

    Private Sub preview(ByVal nReport As String, ByVal pulisci As Boolean, ByVal finito As Boolean)
    ' if pulisci=true clear report else continue
    ' if finito=true preview report
    frx.LoadReportFromFile nReport
    Call settaDatabase
    frx.PrepareReport pulisci
    ' close connection and delete ldb file
    db.Connected = False
    Set db = Nothing
    If finito = True Then frx.ShowPreparedReport
    End Sub

    Private Sub settaDatabase()
    Dim connString As String
    Set db = frx.FindObject("database")
    db.Connected = False
    connString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;"
    connString = connString + "Data Source=" + App.Path + "\data.mdb"
    connString = connString + ";Mode=Read;User ID=;Password="
    db.ConnectionString = connString
    End Sub

    Bruno

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.