View Single Post
  #1 (permalink)  
Old October 8th, 2009, 05:16 PM
ZeroFactorial ZeroFactorial is offline
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default Chpt 9 Reporting

Trying to get a report to print from the Print Button on a GridView Page.

When I run the report I get the following error.
Code:
DataSet does not support System.Nullable<>.
This are my SP, DAL, BLL

Stored Procedure
Code:

ALTER PROCEDURE dbo.ReportTransfersPastWeek
AS
SET NOCOUNT ON
SELECT RequestDate, pName, dob, transFacility, transferReasons, transferDecision
FROM AETransfer

WHERE RequestDate >= dateadd(day, datediff(day,0,GetDate())-7,0)
RETURN
This pulls the entries from the current date to the last 7 seven days.


DAL
Code:
publicclassReportTransfersPastWeekData
{
publicstaticList<ReportTransfersPastWeekResult> SelectPastWeekTransfers()
{
using (HRPaidTimeOffDataContext db = newHRPaidTimeOffDataContext(DBHelper.GetHRPaidTimeOffConnectionString()))
{
return db.ReportTransfersPastWeek().ToList();
}
}
}

BLL
Code:
publicclassReportTransfersPastWeek
{
publicstaticobject[] SelectPastWeekTransfers()
{
returnReportTransfersPastWeekData.SelectPastWeekTransfers().ToArray();
}
}
}
The error happens on this line of code in the GridView Page.
Code:
void Master_PrintButton_Click(object sender, EventArgs e)
{
ReportDocument report = newReportDocument();
report.Load(Server.MapPath("Reports/TransfersPastWeek.rpt"));
//Get the data 
report.SetDataSource(ReportTransfersPastWeek.SelectPastWeekTransfers()); <<<Fails
report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "");
}

Any help would be appreciated. I ran my SQL on the data and it returns valid results. What is going on with the code and design pattern?