J
JR
Hi,
In the code below, any attempt to read data results in the exception
"Invalid attempt to read when no data is present." Examining the
DataReader, the _dataReady is false and HasRows is true. This stored
procedure returns around 1000 records. Any idea why I'm getting this
exception?
thanks,
JR
SqlCommand com = new SqlCommand();
com.Connection = con;
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "xsp_SolomonToSFOpportunity";
com.Parameters.Add("@ProcessDate", DateTime.Now.Subtract(new
TimeSpan(daysPrevious,0,0,0)).ToString("d"));
SqlDataReader dr = com.ExecuteReader();
bool moreRows = dr.Read();
while (moreRows) {
if (dr.IsDBNull(dr.GetOrdinal("ContractID")) ||
dr.GetString(dr.GetOrdinal("ContractID")) == "") {
// do something
}
}
In the code below, any attempt to read data results in the exception
"Invalid attempt to read when no data is present." Examining the
DataReader, the _dataReady is false and HasRows is true. This stored
procedure returns around 1000 records. Any idea why I'm getting this
exception?
thanks,
JR
SqlCommand com = new SqlCommand();
com.Connection = con;
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "xsp_SolomonToSFOpportunity";
com.Parameters.Add("@ProcessDate", DateTime.Now.Subtract(new
TimeSpan(daysPrevious,0,0,0)).ToString("d"));
SqlDataReader dr = com.ExecuteReader();
bool moreRows = dr.Read();
while (moreRows) {
if (dr.IsDBNull(dr.GetOrdinal("ContractID")) ||
dr.GetString(dr.GetOrdinal("ContractID")) == "") {
// do something
}
}