Print Page | Close Window

DataBinding Sample Deficiency Workaround

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=14724
Printed Date: 15 November 2024 at 3:51am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: DataBinding Sample Deficiency Workaround
Posted By: jpbro
Subject: DataBinding Sample Deficiency Workaround
Date Posted: 11 July 2009 at 1:35pm
The CJ databinding implementation is half-baked (for example, it doesn't support VB6 datasource classes), so I don't recommend using it unless you are setting the datasource property directly to a ADO recordset connected to an MS Access database (another forum member has reported probems using databinding with ADO<MSSQL). Try it with your current data stack and if it doesn't work right away, don't fight with it for too long! Switch to using VirtualMode and your own update handling (more work, but it will save you time and pain in the long run).

However, if you are using ADO<MSACCESS and you are using the CJ sample for reference, there is a problem that you should be aware of. If you want your in-grid edits to be saved to the underlying database, you will have to modify the sample as follows:

1) Allow editing in the Form_Load event:


Me.wndRecords.AllowEdit = True


2) Open your recordset as a KeySet with BatchOptimistic locking by modifying the beginning of the ShowRecords sub as follows:


Private Sub ShowRecords(Table As String)
  ' show records
  If Rs.State = adStateOpen Then Rs.Close
  
  Rs.Open "select * from [" & Table & "]", Con, adOpenKeyset, adLockBatchOptimistic, adCmdText
  ' EVERYTHING UNDER RS.OPEN IN EXISTING SHOW RECORDS SUB REMAINS THE SAME


3) Replace the ValueChanged event to update the underlying recordset as follows:


Private Sub wndRecords_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
  If Not wndRecords.Navigator.CurrentFocusInHeadersRows Then
    ' body row
    wndRecords.DataManager.UpdateRecord Item.Record
    Rs.UpdateBatch
  End If
End Sub


Re-run the sample and your data modifications should now persist.


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

Language: Visual Basic 6.0 SP6




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