Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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!





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





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