J
Jiho Han
I am getting a NullReferenceException deep in the bowels of ADO.NET.
I figured out that it only happens when I change column values within RowUpdating
event handler.
private void _dataAdapter_RowUpdating(object sender, OleDbRowUpdatingEventArgs
e)
{
System.Diagnostics.Debug.WriteLine("QueryTable::OnRowUpdating");
if (e.Row.Table.Columns.Contains("MODIFYDATE"))
e.Row["MODIFYDATE"] = DateTime.Now;
if (e.Row.Table.Columns.Contains("MODIFYUSER"))
e.Row["MODIFYUSER"] = "ADMIN";
}
I am simply calling the dataadapter's Update method. I can only guess that
changing the column value in RowUpdating event is changing the internal state
that makes the whole thing fail.
Two questions:
1. Does anyone know what may be happening?
2. How do I troubleshoot this when an error is happening in the framework
like this? The disassembly view doesn't really help since I can't read IL.
I tried Reflector add-in which is good but it doesn't take me to the source
line where it's failing.
Thanks and I took out the above code and I am updating those fields before
I call Update method, following the wisdom gained from the following well-known
joke:
"Doctor, it hurts when I do this."
"Then, don't do it."
Jiho
I figured out that it only happens when I change column values within RowUpdating
event handler.
private void _dataAdapter_RowUpdating(object sender, OleDbRowUpdatingEventArgs
e)
{
System.Diagnostics.Debug.WriteLine("QueryTable::OnRowUpdating");
if (e.Row.Table.Columns.Contains("MODIFYDATE"))
e.Row["MODIFYDATE"] = DateTime.Now;
if (e.Row.Table.Columns.Contains("MODIFYUSER"))
e.Row["MODIFYUSER"] = "ADMIN";
}
I am simply calling the dataadapter's Update method. I can only guess that
changing the column value in RowUpdating event is changing the internal state
that makes the whole thing fail.
Two questions:
1. Does anyone know what may be happening?
2. How do I troubleshoot this when an error is happening in the framework
like this? The disassembly view doesn't really help since I can't read IL.
I tried Reflector add-in which is good but it doesn't take me to the source
line where it's failing.
Thanks and I took out the above code and I am updating those fields before
I call Update method, following the wisdom gained from the following well-known
joke:
"Doctor, it hurts when I do this."
"Then, don't do it."
Jiho