DBDG--Making grid match back-end database

I set up a DBDG using the wizard--i.e. create dataadapter, create dataset, base DBDG on dataset When a user enters dup information or something else NOT allowed by the database I catch the error (Try..Catch block--see below) but the DBDG is not updated to display this. i.e. If ''Name'' must be unique (in database) and user enters ''John'' 50X in the grid it will appear only once in the database but 50X in the grid. Same thing applies to deleting records which are/have foreign keys: won''t be deleted from DB but will be deleted from DBDG. Not sure if I should refresh the DBDG or actively delete/add the current cell Try Me.adpGroup.Update(Me.dtsGroup1.sct_Group) Catch ex As Exception errorMessage = ex.Message.ToString() errorMessage = "Group " + CStr(Me.grdGroup(rowIndex, 1).CellValue) + " NOT UPDATED. " + errorMessage ''SOMETHING MUST BE DONE HERE Finally Me.stpErrors.Text = eventDisplay + errorMessage End Try

3 Replies

AD Administrator Syncfusion Team September 14, 2005 02:59 PM UTC

After, getting the error, try calling Refresh on the CurrencyManager to see if this will handle this problem. CurrencyManager cm = me.grid.BindingContext(me.grid.DataSource, me.grid.DataMember) cm.Refresh()


DC dan carr September 14, 2005 03:55 PM UTC

Did not work. Record still appears (even though not inserted in DB) Added: Dim cm As CurrencyManager = Me.grdGroup.Binder.BindingContext(Me.grdGroup.DataSource, Me.grdGroup.DataMember) cm.Refresh() Thanks, Dan


AD Administrator Syncfusion Team September 15, 2005 08:46 AM UTC

Hi Dan, Your Direct Trac incident id 20955 is updated. Regards, Stanley

Loader.
Up arrow icon