Data Grid - Save problems  
Author Message
Ragas





PostPosted: Visual Basic General, Data Grid - Save problems Top

I have Purchase Order Header and Line items in a Master-details format in a form

The line items are updated in a DataGrid and the header fields are "form" controls [like text boxes, date control, combobox etc]

The primary key is a GUID field. When the user clicks on "Save", I do the following to generate a GUID value

If String.IsNullOrEmpty(Me.GlobalIDTextBox.Text) Then

Me.GlobalIDTextBox.Text = System.Guid.NewGuid.ToString

End If

Once the header is updated, I enter line item details in the grid and clicked on "Save" again. That saves the record in the database [so far so good]

Now, If I start entering valu in the grid [without saving the header first], I am getting a null value exception as the "Primary Key" is not yet saved against the header. I would like to be able to enter all the data in the "Data Grid" and the header and click on "Save" only once.

Questions:

How can I update the newly added Grid row with a Header GUID value so that it does not throw and error

Thanks




Visual Basic4  
 
 
Ragas





PostPosted: Visual Basic General, Data Grid - Save problems Top

Any one !