Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SaveEntitiy() tries to insert NULLS
Message
De
23/12/2009 15:10:27
 
 
À
15/12/2009 14:02:05
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01439152
Message ID:
01440399
Vues:
44
Sorry, I should have explained the history a little more. I actually started with the fully-automatic form. The reason I'm manually inserting values in the code sample I gave you is because I got the same NULL insert problem even with the automatic binding. All of the validations succeed, but at the actual point of saving the data they have somehow all become NULL.

I'm wondering if it has something to do with the way I'm manually creating a new record. I have other posts on that. In short, the project spec calls for all columns in the list grid to be sortable. There are problems with MM and a sorted grid. I saw in the MM source code where the New button action specifically tries to load the last record. Well once the grid is sorted, the new record is actually the FIRST record if the grid is sorted ascending, or LAST record if the grid is descending. So the rigid navigation programmed into the framework is incompatible. To get around that, I used a mmButton control instead of mmButtonNew. My click handler simply uses this instruction:
mbAddingRecord = true
NewEntity (mdacAttorney, Nothing)
mbAddingRecord = false
NewEntity() is a MM method. "mdacAttorney" is my busniess object. "Nothing" is the default value parameter. I thought that might the problem, so I also tried passing an empty string. But regardless of the default value, the bottom line is that MM is somehow blowing away all the values I typed into the text boxes somewhere between the validation process and the actual data access save operation.

FYI, to handle data set navigation I have this RowAdded handler:
Private Sub dgvSummary_RowsAdded(ByVal sender As System.Object, ByVal e As _
    System.Windows.Forms.DataGridViewRowsAddedEventArgs) Handles dgvSummary.RowsAdded
        If mbAddingRecord Then
            Me.BindingContext(Me.mdacAttorney.GetCurrentDataSet(), "Attorney").Position = e.RowIndex
            SelectGridRow(e.RowIndex)  ' Ensure the grid selects the new row and scrolls until the row is in view
        End If
    End Sub
Is there something wrong with my manual new record creation that would cause the nullification of values when trying to save the record?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform