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