R
Rodusa
I am getting an error on line 133. I am trying to update a datarow
using the find method, but it keeps throwing the error below:
int ItemKey = dv.Find(Item.inv_mast_uid);
DataRow dr;
if (ItemKey==-1) // NOT FOUND
{
dr = dt.NewRow();
dr["uid"] = Item.inv_mast_uid;
dr["rank"] = 1;
dr["item_id"] = Item.item_id;
dr["item_desc"] = Item.item_desc;
dr["extended_desc"] = Item.extended_desc;
dt.Rows.Add(dr);
}
else // IF FOUND
{
dr = dt.Rows.Find(ItemKey);
dr["item_desc"] = "testing";
}
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
Line 131:
Line 132: dr = dt.Rows.Find(ItemKey);
Line 133: dr["item_desc"] = "testing";
Thank you
using the find method, but it keeps throwing the error below:
int ItemKey = dv.Find(Item.inv_mast_uid);
DataRow dr;
if (ItemKey==-1) // NOT FOUND
{
dr = dt.NewRow();
dr["uid"] = Item.inv_mast_uid;
dr["rank"] = 1;
dr["item_id"] = Item.item_id;
dr["item_desc"] = Item.item_desc;
dr["extended_desc"] = Item.extended_desc;
dt.Rows.Add(dr);
}
else // IF FOUND
{
dr = dt.Rows.Find(ItemKey);
dr["item_desc"] = "testing";
}
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
Line 131:
Line 132: dr = dt.Rows.Find(ItemKey);
Line 133: dr["item_desc"] = "testing";
Thank you