Creating new records in a bound ProDataSet

Posted by robert.baker on 18-Aug-2008 14:26

I'm sorry if this has already been answered and I haven't found it yet.

I am using all bound TextBox controls to both the top-level and a child table of a dataset and am wanting to create a new row for both with the click event of a button. I was reading through the UpdatableDataBindingGrid sample from the Advanced GUI Programming PDF, but am sort of confused as to the order of events. I am not sure when the CreateRow event is actually getting triggered or when the actual create statements are supposed to happen. Can I create both parent and child records together and keep them synchronized with the query?

I also looked at the purchaseOrderForm.cls from the documentation samples but that one appears to just be a single table.

Does anyone know of a sample form that does this? I have a feeling that I'm missing something simple here.

All Replies

Posted by Simon de Kraa on 19-Aug-2008 14:41

Let's start the discussion by quoting the manual...

CancelCreateRow

Published when some user action cancels a create row operation in the bound .NET control (for example, pressing ESCAPE in a new empty row).

CreateRow

Published when some user action initiates a create row operation in the bound .NET control (for example, clicking in a new empty row at the bottom of a control).

But you want to run the code manually by clicking a button? And create for example Customer/Order/Orderline records in a single action?

Posted by robert.baker on 19-Aug-2008 16:18

I would like to use a button (e.g. Add ) to create the parent record and then based on the data that the user enters create the child record.

Posted by robert.baker on 22-Aug-2008 18:02

On a similar note here.

I have been sort of recreating simple maintenance screens by employing the techniques from the purchaseOrderForm sample.

The first form I created with an Infragistics UltraWinGrid and multiple TextBox controls. I use a Button to call a method in a service adapter class to add a new record to my top-level table of my dataset:

serviceAdapter:addRecord(bindingSource1:handle:get-buffer-handle('eCustomer')).

which is:

method public void addRecord(input hBuffer as handle):

define variable hQuery as handle no-undo.

define variable rRowId as rowid no-undo.

hQuery = hBuffer:query.

hBuffer:buffer-create() no-error.

rRowId = hBuffer:rowid.

hQuery:create-result-list-entry().

hQuery:reposition-to-rowid(rRowId).

end method.

I actually took this code right out of the sample.

Once this happens I see a new row created in the UltraWinGrid control and all my bound TextBox controls reflect this as well. I can then enter data into my fields and save without error.

Then I created another form using a System.Windows.Forms.DataGridView and TextBox controls. I repeat the same process with identical code, however I do not see the new record reflected in the datagrid or the text boxes. If I 'Save' I will get an empty record.

Has anyone else seen this behavior? I'm stuck without an answer.

Posted by timrmci on 30-Nov-2010 18:51

Hi,

Im trying to do the exact same thing, did you end up figuring this out ? I am havng a similar issue, having multiple grids in the same form.

Im also having issues with the buffer-create when there are no records in the dataset.

any help greaty appreciaited

Cheers


Tim

This thread is closed