Convert a datetime to string
<p>Howsit! </p>

<p>I encounter an error when i get a null value in my datareader. </p>

<pre><code>public List&lt;Complaint&gt; View_all_complaints()
{
    csDAL objdal= new csDAL();
    List&lt;Complaint&gt; oblcomplist=new List&lt;Complaint&gt;();

    using( IDataReader dr=objdal.executespreturndr("View_all_complaints"))
    {
        while (dr.Read())
        {
            Complaint objcomp= new Complaint();
            populate_reader(dr,objcomp);
            oblcomplist.Add(objcomp);
        }
    }
    return oblcomplist;
}

public void populate_reader(IDataReader dr, Complaint objcomp)
{
    objcomp.ref_num = dr.GetString(0);
    objcomp.type = dr.GetString(1);
    objcomp.desc = dr.GetString(2);
    objcomp.date = dr.GetDateTime(3);
    objcomp.housenum = dr.GetInt32(4);
    objcomp.streetnum = dr.GetInt32(5);
    objcomp.status = dr.GetString(6);
    objcomp.priority = dr.GetString(7);
    objcomp.cid = dr.GetInt32(8);
    if (!dr.IsDBNull(9))
    {
        objcomp.resolved_date = dr.GetDateTime(9);
    }
}
</code></pre>

<p>in sql resolved date allows null values, this is so because only when a complaint has been resolved , it must reflect that date otherwise it should be null. </p>

<p>if dr.getdatetime(9) is null then it must just set a string saying "Not Resolved"</p>

<p>please help!</p>
