Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete on DataGrid
Message
De
23/01/2005 14:24:43
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Delete on DataGrid
Divers
Thread ID:
00979833
Message ID:
00979833
Vues:
48
Hi , does anybody have an idea on how to delete records using data grid? current i use the button column and insert the following code . I receive and error of "Object reference not set to an instance of an object" probably on "rowChange.Delete();" is check the MSDN and seems to exact. did i miss something? tnx.


===============

private void grdUserGroup_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
this.oConn.ConnectionString=ConfigurationSettings.AppSettings["connectionString"];
try
{
// Open COnnection
this.oConn.Open();


dsUserCompany.CustEmpVendorRow rowChange;

int key = int.Parse( (this.grdUserGroup.DataKeys[e.Item.ItemIndex].ToString() ));
rowChange= this.dsUserCompany1.CustEmpVendor.FindByPkCustEmpVenID(key );
rowChange.Delete();
this.sqlDaUseCompany.Update(this.dsUserCompany1);

this.oConn.Close();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}


}
Roses are #FF0000 Violets are #0000FF all my base are belong to you
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform