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
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
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