Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 8th, 2009, 05:16 PM
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?
  #2 (permalink)  
Old October 9th, 2009, 02:50 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default

Was able to figure this out. Datasets can't except nullable types that is what the error was eluding to. The only thing that was throwing me off what that it allowed me to make a dataset with types that it couldnt handle. So MS should either notify you or build datasets so they except nullable types.

Geesh chasing this down for nothing. So when building your tables and databases it would appear to be best practice or (forced practice) to not allow nullables for fields.

Hope this helps someone out and please let me know if you have any questions.

-Zero
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chpt 17 -Error in instructions Meister1867 BOOK: Professional DotNetNuke 5: Open Source Web Application for ASP.NET ISBN: 978-0-470-43870-1 0 August 31st, 2009 01:13 AM
Chpt 12 Bulk Copy smiller BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 February 13th, 2007 11:25 PM
Chpt 6 pg 204-205 harrison4411 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 June 10th, 2006 09:52 AM
Chpt 6 Why Not Try...template & navigation turtle10 Dreamweaver (all versions) 2 September 23rd, 2004 04:14 PM
Chpt 3 Please Help Me! nmj001 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 July 24th, 2003 10:52 PM



All times are GMT -4. The time now is 01:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.