' Fixing the problem with DataBind under ' "datenhaus GmbH" driver dhRichClient3.dll ver 3.0.0.1 ' and sqlite36_engine.dll
Option Explicit Private mo_Cnn As dhRichClient3.cConnection Private mo_Rs As dhRichClient3.cRecordset
Private Sub Form_Load() Dim l_Path As String: l_Path = App.Path & "\sample.db" Dim l_Connected As Boolean Set mo_Cnn = libFactory.C.Connection With mo_Cnn ' Create or open the database connection If LenB(Dir$(l_Path)) = 0 Then ' DB Doesn't exist, so create it l_Connected = .CreateNewDB(l_Path) If l_Connected Then ' Add some sample records to the database .BeginTrans If .Execute("CREATE TABLE ""test"" (""id"" INTEGER PRIMARY KEY, ""title"" TEXT)") Then .Execute "INSERT INTO test (title) VALUES ('Title1')" .Execute "INSERT INTO test (title) VALUES ('Title2')" .Execute "INSERT INTO test (title) VALUES ('Title3')" .Execute "INSERT INTO test (title) VALUES ('Title4')" .Execute "INSERT INTO test (title) VALUES ('Title5')" End If .CommitTrans End If Else ' DB exists, so just open it l_Connected = .OpenDB(l_Path) End If End With
Dim Record As ReportRecord Dim l_Binded As Boolean If l_Connected Then ' Open the sample recordset to bind to the report control. Set mo_Rs = mo_Cnn.OpenRecordset("SELECT * FROM test") If Not mo_Rs Is Nothing Then ' Bind the recordset to the reportcontrol and populate the control With Me.ReportControl1 With .DataManager 'Set .DataSource = mo_Rs.DataSource 'THIS IS WRONG WAY for THIS DRIVER - Recordset return -1 records Set .DataSource = mo_Rs.GetADORsFromContent ' THIS IS PROPER WAY - Recordset return 5 records l_Binded = .DataBind End With End With End If End If End Sub
------------- Mark Doubson, Ph.D.
|