J
Jordan Richard
I'm just wondering if there is a faster way (better performance or fewer
lines of code) to retrieve one single value from a DataRow.
Here is what I'm currently doing when I just need a single integer value
from the DataRow:
int someID = 0;
if (DT.Rows.Count == 1) {
DataRow DR;
DR = DT.Rows[0];
someID= Convert.ToInt32(DR["SomeID"]);
}
Please note that I'm not using ExecuteScalar to retrieve one single value
from the underlying data source because I'm using many other columns in that
DataRow elsewhere in the same method.
Thanks!
lines of code) to retrieve one single value from a DataRow.
Here is what I'm currently doing when I just need a single integer value
from the DataRow:
int someID = 0;
if (DT.Rows.Count == 1) {
DataRow DR;
DR = DT.Rows[0];
someID= Convert.ToInt32(DR["SomeID"]);
}
Please note that I'm not using ExecuteScalar to retrieve one single value
from the underlying data source because I'm using many other columns in that
DataRow elsewhere in the same method.
Thanks!