I am using trying to get some data out of a SQL 2000 database via
stored procedure, but I am getting some strange results. It will pull
back the first 3 fields but the rest (7 other fields) seem to be
empty, and not just DBNull, but the objects just aren't there.
Here is the code:
SqlCommand cmd = new SqlCommand("psx_GetIntlAdrress", cn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter paraOrderID = new SqlParameter("@OrderID",
paraOrderID.Value = SourceMessage.SelectSingleNode("/Orders/
SqlDataReader rsIntlOrder = cmd.ExecuteReader();
This gives me the "Object reference not set to an instance of an
string sSomeValue = rsIntlOrder != DBNull.Value ?
rsIntlOrder.ToString().Trim() : "";
I have verified that the stored procedure is returning all values. If
I break one a line that works and look at the datareader it shows that
there are 10 fields, but only the first 3 will not throw an error.
Drilling down, the remaining elements show System.InvalidCastException
for all data types. Not sure what is going wrong here, hoping someone