Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error encountered on null fields during data display

Status
Not open for further replies.

SCantoria

Programmer
Sep 23, 2005
100
US
Below is the code I am using and I keep getting a "The value for column 'sysEndDate' in table 'cp' is DBNull"

There are other null fields but sysEndDate is the only one I am testing for now. I will validate the other fields after I resolve this issue.

Please help.


protected void gvCP_SelectedIndexChanged(object sender, EventArgs e)
{
int y = int.Parse(gvCP.SelectedValue.ToString());
lblEditCPID.Text = gvCP.SelectedValue.ToString();

IRISTableAdapters.cpTableAdapter cp = new IRISTableAdapters.cpTableAdapter();
IRIS.cpDataTable dt = cp.spGetCP(y);
IRIS.cpRow r = dt[0];

lblEditCPID.Text = r.cpID.ToString();
txtCorpName.Text = r.corporateName.ToString();
txtProjectName.Text = r.projectName.ToString();
txtFolderName.Text = r.folderName.ToString();
txtProjectStatus.Text = r.projectStatus.ToString();
lblSysStartDate.Text = r.sysStartDate.ToString();

if (r.sysEndDate == DBNull)
{
txtSysEndDate.Text = "";
}
else
{
txtSysEndDate.Text = r.sysEndDate.ToString();

}

txtProjectStartDate.Text = r.projectStartDate.ToString();
txtProjectEstEndDate.Text = r.projectEstEndDate.ToString();
txtProjectEndDate.Text = r.projectEndDate.ToString();
txtProjectExtStartDate.Text = r.projectExtStartDate.ToString();
txtProjectExtEndDate.Text = r.projectExtEndDate.ToString();
}
 
if (r.sysEndDate == DBNull.Value)

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top