Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Report Control DataBind for SQL Lite
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Report Control DataBind for SQL Lite

 Post Reply Post Reply
Author
Message
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Topic: Report Control DataBind for SQL Lite
    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

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.201 seconds.