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;
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();
}
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;
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();
}