Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unable to Save Updates to MM.NET Grid
Message
De
08/09/2005 17:42:57
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Unable to Save Updates to MM.NET Grid
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01047894
Message ID:
01047894
Vues:
42
Getting an Object reference not set to an instance of an object when saving updates to a MM.NET Grid.

This specifically is bombing out in the Business Rules CheckRulesHook.
When my first Validate function is called the parameter Me.DataRow("CompanyOrVendorName").ToString has a value of Nothing. This is where the exception is raised.

So how can a resolve using this CheckRulesHook with the web form grid's UpdateCommand???

The Update Command code:
    Private Sub LogDataGrid_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles LogDataGrid.UpdateCommand
        ' Get the row number to be updated
        Me.LogDataGrid.EditItemIndex = e.Item.ItemIndex
        ' Remove the previous Log DataSet
        Dim dsLog As DataSet = CType(Session("dsLog"), DataSet)
        ' Save the DataSet (the DataGrid automatically binds back)
        Me.oLog.SaveDataSet(dsLog)
        'Me.Save(Me.oLog, dsLog)
        ' Reset the edited item and rebind the DataGrid
        Me.LogDataGrid.EditItemIndex = -1
        Me.BindControl(LogDataGrid)
    End Sub
The Log BO CheckRulesHook code:
    Public Overrides Function CheckRulesHook(ByVal ds As DataSet, ByVal tableName As String) As Boolean
        Me.ValidateCompanyOrVendorName(Me.DataRow("CompanyOrVendorName").ToString)
        Me.ValidateCompanyOrVendorAbbreviation(Me.DataRow("CompanyOrVendorAbbreviation").ToString)
        Me.ValidateLogType(Me.DataRow("LogType").ToString)
        Me.ValidateProject(Me.DataRow("Project").ToString)
        Me.ValidateProjectName(Me.DataRow("ProjectName").ToString)
        Me.ValidateProjectCityState(Me.DataRow("ProjectCityState").ToString)

        Return Me.ErrorProviderBrokenRuleCount = 0
    End Function
The stack trace for the exception:
NullReferenceException: Object reference not set to an instance of an object.]
OakLeaf.MM.Main.Business.mmBusinessObject.PreSaveProcessing(DataSet ds, String tableName)
OakLeaf.MM.Main.Business.mmBusinessObject.CheckRules(mmBusinessObject businessObject, DataSet ds, String tableName)
OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey, IDbDataAdapter dbAdapter)
OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey)
OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName)
OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds)
ABC.MyApplicationWeb.LogTracking.LogDocuments.LogDataGrid_UpdateCommand(Object source, DataGridCommandEventArgs e) in C:\Documents and Settings\ouruser\VSWebCache\PC\MyApplicationWeb\LogDocuments.aspx.vb:110
System.Web.UI.WebControls.DataGrid.OnUpdateCommand(DataGridCommandEventArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e)
OakLeaf.MM.Main.Web.UI.WebControls.mmDataGrid.OnBubbleEvent(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group
Répondre
Fil
Voir

Click here to load this message in the networking platform