B
Bill Gower
I am returning data using a SqlDataReader. Here is a snippet of code where
I am having a problem. What is the best way to handle nulls?
private void TGenerateJobSiteList2FromReader<T>(SqlDataReader returnData,
ref List<JobSite> jobSiteList)
{
while (returnData.Read())
{
JobSite jobSite = new
JobSite((string)returnData["JobName"], (int)returnData["JobSiteId"],
(string)returnData["Addr1"], (string)returnData["Addr2"],
(string)returnData["City"],
(string)returnData["state"]);
jobSiteList.Add(jobSite);
}
}
I am having a problem. What is the best way to handle nulls?
private void TGenerateJobSiteList2FromReader<T>(SqlDataReader returnData,
ref List<JobSite> jobSiteList)
{
while (returnData.Read())
{
JobSite jobSite = new
JobSite((string)returnData["JobName"], (int)returnData["JobSiteId"],
(string)returnData["Addr1"], (string)returnData["Addr2"],
(string)returnData["City"],
(string)returnData["state"]);
jobSiteList.Add(jobSite);
}
}