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 August 31st, 2009, 01:24 PM
Registered User
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cast Problem With Select Technique in Chapter 2

Hi there,

I am pulling my hair out a result of what I sure is a simple issue.

In trying to implement the Select(ID) in the DAL technique in Chapters 2 and 3, I continue to receive am InvalidCastException error on returning the result from the LINQ query to the database object. I need help with the Cast or another technique. Is there a simple method to convert the iQueryable result to the TEntity object? Is this even the issue?

Code:
 public override Application Select(string name)
{
 using (fvLINQToSQLDataContext db = new fvLINQToSQLDataContext(DBHelper.GetForecastVelocityConnectionString()))
  {
   ISingleResult<Application> app = db.Applications_GetByName(name);
   return app.Single();
   }
 }
}
Where Application is the name of the Data Class created when I added a table from my database to the Designer face.

Thanks!
 


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
Cast Problem in Web service proxy Amit_Topper Crystal Reports 0 January 20th, 2007 03:28 AM
Problem with validation technique of DTPicker. abhioak VB Components 0 February 21st, 2006 12:11 AM
Another "Specified Cast Not Valid" Problem radiohalo5 BOOK: ASP.NET Website Programming Problem-Design-Solution 0 February 15th, 2006 01:50 PM
problem in cast of type yoord SQL Language 1 October 18th, 2004 03:19 PM
cast problem vickyj General .NET 6 September 8th, 2004 06:21 AM



All times are GMT -4. The time now is 12:28 AM.


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