Print Page | Close Window

Report Control DataBind for SQL Lite

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=14721
Printed Date: 03 June 2024 at 12:13am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Report Control DataBind for SQL Lite
Posted By: mdoubson
Subject: Report Control DataBind for SQL Lite
Date Posted: 10 July 2009 at 12:33pm

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



Replies:
Posted By: jpbro
Date Posted: 10 July 2009 at 1:35pm
Unfortunately GetADORsFromContent more than triples the memory requirement (and doesn't seems to support bound edits back to the database). Better than nothing I guess, but limited in usefulness. If you are using non-ADO recordset data sources, you should probably stick with Virtual Mode and handle display/updates yourself.



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: mdoubson
Date Posted: 10 July 2009 at 1:37pm
I agree - virtual mode is most efficient way for custom solutions
 
How you measure the memory used - this is your data -
No RS created: 19476 MB
After SQLite RS: 21932 MB
After setting datasource to GetADORsFromContent: 30740 MB
 
Just be TaskManager?


-------------
Mark Doubson, Ph.D.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net