Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - DataBinding Sample Deficiency Workaround
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

DataBinding Sample Deficiency Workaround

 Post Reply Post Reply
Author
Message
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 Topic: DataBinding Sample Deficiency Workaround
    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

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.156 seconds.