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 March 24th, 2009, 07:47 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default BLL Edit Object Class

Never amazes me how I always get a nice little Error Message at the end of my work day.

I have gotten my tables added to the ORM and understand how it all works.

Today I built the Data and Business Classes for them. In one of my tables I have 5 DateTime fields. When I run the app I get an error that states:

Code:
Error 1 Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime'. An explicit conversion exists (are you missing a cast?)
for each DateTime field.

I then went and compared my AETransfersEO to the PTORequestEO from the Framework which has an additional DateTime field in the form of RequestDate. The override from both files are identical. I would post my code but it takes 75 arguments and would be really long.

If anyone knows what I missed I would appreciate it. I just get stuck on the error code until I understand what it is telling me. To me it says that it cannot take the Property (@reqDate of type DateTime) and implicitly(understood type) convert it to DateTime. I do not understand what the explicit(direct) conversion is or where it exists. Im sure with time I will figure it out, but I like to share my experience with others so they may learn too.

Thanks

We Learn from Eachother
  #2 (permalink)  
Old March 25th, 2009, 01:35 PM
Wrox Author
 
Join Date: Jan 2009
Posts: 73
Thanks: 0
Thanked 7 Times in 7 Posts
Default

System.DateTime? means it is a nullable data type. I assume your fields allow nulls so the ORM creates the entity object with properties as nullable types and the parameters to the stored procedure are declared to the same way. Make sure you declare the variables in the business classes as nullable also.
  #3 (permalink)  
Old March 25th, 2009, 01:42 PM
Authorized User
 
Join Date: Mar 2009
Posts: 79
Thanks: 4
Thanked 4 Times in 4 Posts
Default

Quote:
Originally Posted by varallov View Post
System.DateTime? means it is a nullable data type. I assume your fields allow nulls so the ORM creates the entity object with properties as nullable types and the parameters to the stored procedure are declared to the same way. Make sure you declare the variables in the business classes as nullable also.
Ok, that makes sense now. I was thinking System.DataTime? reference the @FieldName parameter, but it means it is nullable. Does this only relate to the DataTime field or are there other DataTypes that can generate this?
Good thing is that I will recognize it in the future.

Thanks
  #4 (permalink)  
Old March 25th, 2009, 02:17 PM
Wrox Author
 
Join Date: Jan 2009
Posts: 73
Thanks: 0
Thanked 7 Times in 7 Posts
Default

Nullable types are supported for other intrinsic types as well such as int, byte, double, etc.
 


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
Getting the object name within a class Koeno VB.NET 5 July 15th, 2008 01:52 PM
access class object Sheraz Khan ASP.NET 2.0 Professional 0 September 10th, 2007 06:19 PM
Why not using a common detail class for DAL BLL Ghistos BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 April 17th, 2007 01:04 AM
referencing an object in an edit item template dan195 ASP.NET 1.0 and 1.1 Basics 3 September 25th, 2006 07:15 AM
java class edit mode mateenmohd Java GUI 2 March 8th, 2004 06:31 AM



All times are GMT -4. The time now is 01:39 AM.


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