Actually I have query which returns me 5 columns and values(date) for each or them in a single row but what I want is the columns names should be in a single column Title
and its (Vale) in second columns in Date
.
Note Title
and Date
are the columns of the temporary table I just created run time.
Here is my piece of code I am using,
protected void btnAlerts_Click(object sender, EventArgs e)
{
fnSaveAlerts();
}
private void fnSaveAlerts()
{
DataTable dtTemp = new DataTable();
DataColumn dtC1 = new DataColumn();
dtC1.DataType = typeof(String);
dtC1.ColumnName = "Title";
DataColumn dtc2 = new DataColumn();
dtc2.DataType = typeof(DateTime);
dtC1.ColumnName = "Date";
dtTemp.Columns.Add(dtC1);
dtTemp.Columns.Add(dtc2);
LeadsContracts ObjLeadsContract = new LeadsContracts();
ObjLeadsContract.ExecuteSql(@"select dtDisclosure, dtDueDiligence,
dtFinanceAppraisals, dtFreeTextDate1,
dtFreeTextDate2
from LeadsContracts
where dtDisclosure is not null
and dtDueDiligence is not null
and dtFinanceAppraisals is not null
and dtFreeTextDate1 is not null
and dtFreeTextDate2 is not null");
dtTemp.DataSet = ObjLeadsContract.DefaultView; // it also gives error here "Red line"
}
I have already spend whole day to do this, please any body can help me. thanks in advance