Click here to Skip to main content
       

C#

 
AnswerRe: Dynamic Width Height Winform PinmemberMycroft Holmes5-Feb-13 22:17 
QuestionMake Design Appear as it Would in a Browser [modified] PinmemberASPnoob5-Feb-13 5:24 
AnswerRe: Make Design Appear as it Would in a Browser PinmentorKeith Barrow5-Feb-13 5:57 
GeneralRe: Make Design Appear as it Would in a Browser PinmemberASPnoob5-Feb-13 6:22 
QuestionMySql is not listed in data source part! Pinmembersina rafati nia4-Feb-13 22:28 
AnswerRe: MySql is not listed in data source part! PinmvpEddy Vluggen5-Feb-13 0:47 
GeneralRe: MySql is not listed in data source part! Pinmembersina rafati nia5-Feb-13 22:49 
GeneralRe: MySql is not listed in data source part! PinmvpDave Kreskowiak6-Feb-13 1:48 
AnswerRe: MySql is not listed in data source part! Pinmembersina rafati nia6-Feb-13 19:14 
QuestionPropagating a MySQL Database Transaction Rollback through WCF using MSMQ PinmemberGer Hayden4-Feb-13 21:44 
AnswerRe: Propagating a MySQL Database Transaction Rollback through WCF using MSMQ PinprotectorPete O'Hanlon4-Feb-13 22:18 
GeneralRe: Propagating a MySQL Database Transaction Rollback through WCF using MSMQ PinmemberGer Hayden4-Feb-13 22:47 
QuestionTo get the info for how to validate an embedded object in office files Pinmemberavi21274-Feb-13 19:54 
QuestionC# linq to sql error Pinmemberdcof4-Feb-13 12:32 
In a C# 2008 desktop application, I have the following statement that give when an error when the code points to a different database:
 eRPTDataContext rptDataaddRVW = new eRPTDataContext();
 var eRPTaddRVW = (from a in rptDataaddRVW.eRPT_Transaction_Trackings
                   where a.Package_ID == packageId
                   select a).FirstOrDefault();
 
Here is the error message I get:
2013-02-04 16:13:15.3731|ERROR|erptsampleclient.eRPTSample|Error Processing --> Specified cast is not valid.
2013-02-04 16:13:15.3731|ERROR|erptsampleclient.eRPTSample|************* Stack Trace *******************
2013-02-04 16:13:15.3887|ERROR|erptsampleclient.eRPTSample|   at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
   at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
   at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
   at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
   at erptsampleclient.eRPTSample.addNewReviewPackage() in C:\_svn\Cas_client\erptsampleclient\eRPTSample.cs:line 1308
2013-02-04 16:13:15.3887|ERROR|erptsampleclient.eRPTSample|Error Processing --> Specified cast is not valid.
2013-02-04 16:13:15.3887|ERROR|erptsampleclient.eRPTSample|************* Stack Trace *******************
2013-02-04 16:13:15.4043|ERROR|erptsampleclient.eRPTSample|   at erptsampleclient.eRPTSample.addNewReviewPackage() in C:\_svn\Cas_client\erptsampleclient\eRPTSample.cs:line 1369
   at erptsampleclient.eRPTSample.Main(String[] args) in C:\_svn\Cas_client\erptsampleclient\eRPTSample.cs:line 154
2013-02-04 16:13:23.3135|INFO|erptsampleclient.eRPTSample|******************ADD (CREATE) REVIEW (RVW) (METHOD 2 CALL)**********************
2013-02-04 16:13:28.8359|INFO|erptsample.ERPTProxy|The number of attachments in the list are ->1
2013-02-04 16:13:54.2171|INFO|erptsample.ERPTProxy|add review package successfully for rvw pkg id: RVW0204201300524 return code = 0
2013-02-04 16:13:58.5227|INFO|erptsampleclient.eRPTSample|Review Package was created successfully for Package id: RVW0204201300524
2013-02-04 16:13:58.5695|ERROR|erptsampleclient.eRPTSample|Error Processing --> Specified cast is not valid.
2013-02-04 16:13:58.5695|ERROR|erptsampleclient.eRPTSample|************* Stack Trace *******************
2013-02-04 16:13:58.5851|ERROR|erptsampleclient.eRPTSample|   at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
   at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
   at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
   at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
 

When I change the code to the following:
var eRPTaddRVW = (from a in rptDataaddRVW.eRPT_Transaction_Trackings
                   where a.Package_ID == packageId
                   select new { erptPackageID = a.Package_ID, erptFileLocation = a.File_Location }).FirstOrDefault();
M
I do not get an error.
The problem is I want to be able to update the database row I just accessed and the linq will not compile clean to let me do that.
 
I am getting the follwowing error message when I try to access a specific field:
Error 10 'object' does not contain a definition for 'erptFileLocation' and no extension method 'erptFileLocation' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) C:\_svn\Cas_client\erptsampleclient\eRPTSample.cs 1320 56 ERPTsampleclient
Here is the code I am trying to add:
    if (eRPTaddRVW != null)
       {
         eRPTaddRVW.erptFileLocation = RVWFile; // save location of original spreadshgeet
         rptDataaddRVW.SubmitChanges();
} 
Can you tell me what I can do to solve my problem?
AnswerRe: C# linq to sql error PinmemberSimon_Whale4-Feb-13 12:59 
GeneralRe: C# linq to sql error Pinmemberdcof4-Feb-13 16:22 
QuestionStepper motor control by using Fez mini PinmemberMember 98108984-Feb-13 12:22 
AnswerRe: Stepper motor control by using Fez mini PinmvpOriginalGriff5-Feb-13 1:24 
GeneralRe: Stepper motor control by using Fez mini PinmemberMember 98108985-Feb-13 1:46 
GeneralRe: Stepper motor control by using Fez mini PinmvpOriginalGriff5-Feb-13 1:53 
GeneralRe: Stepper motor control by using Fez mini PinmemberMember 98108985-Feb-13 1:58 
AnswerRe: Stepper motor control by using Fez mini PinmvpDave Kreskowiak5-Feb-13 2:36 
GeneralRe: Stepper motor control by using Fez mini PinmemberMember 98108985-Feb-13 2:49 
GeneralRe: Stepper motor control by using Fez mini PinprotectorPete O'Hanlon5-Feb-13 4:21 
GeneralRe: Stepper motor control by using Fez mini PinmemberMember 98108985-Feb-13 13:06 
GeneralRe: Stepper motor control by using Fez mini PinmvpDave Kreskowiak5-Feb-13 5:12 
Questionhow to make a movable button in c# Pinmembermortezakazemi684-Feb-13 4:24 
AnswerRe: how to make a movable button in c# PinprotectorPete O'Hanlon4-Feb-13 4:59 
JokeRe: how to make a movable button in c# PinmemberMycroft Holmes5-Feb-13 22:21 
AnswerRe: how to make a movable button in c# PinmvpAbhinav S4-Feb-13 5:42 
AnswerRe: how to make a movable button in c# PinprofessionalAmir Mohammad Nasrollahi29-Jul-13 22:51 
QuestionUninstallation of msi file programatically PinmemberNarVish4-Feb-13 0:27 
AnswerRe: Uninstallation of msi file programatically PinmvpEddy Vluggen4-Feb-13 0:30 
General.Re: Uninstallation of msi file programatically PinmemberNarVish4-Feb-13 0:37 
AnswerRe: .Re: Uninstallation of msi file programatically PinmvpEddy Vluggen4-Feb-13 7:46 
AnswerRe: Uninstallation of msi file programatically PinmvpAbhinav S4-Feb-13 1:02 
GeneralRe: Uninstallation of msi file programatically PinmemberNarVish4-Feb-13 1:25 
AnswerRe: Uninstallation of msi file programatically PinmemberSimon_Whale4-Feb-13 1:42 
GeneralRe: Uninstallation of msi file programatically PinmemberNarVish4-Feb-13 1:52 
AnswerRe: Uninstallation of msi file programatically PinmemberRichard Deeming4-Feb-13 2:03 
GeneralRe: Uninstallation of msi file programatically PinmemberNarVish4-Feb-13 2:10 
QuestionPaging in ASP.NET C# PinmemberHarshaKN3-Feb-13 22:51 
AnswerRe: Paging in ASP.NET C# PinmemberSimon_Whale4-Feb-13 0:10 
Questionform don't respond immiditly Pinmembermohammadkaab3-Feb-13 21:52 
AnswerRe: form don't respond immiditly PinmvpOriginalGriff3-Feb-13 22:09 
AnswerRe: form don't respond immiditly PinmentorDaveyM694-Feb-13 2:20 
GeneralRe: form don't respond immiditly Pinmembermohammadkaab5-Feb-13 22:50 
GeneralRe: form don't respond immiditly PinmentorDaveyM697-Feb-13 8:00 
QuestionCannot access string in System.String[] [modified] PinmemberAmbiguousName3-Feb-13 21:06 
AnswerRe: Cannot access string in System.String[] Pinmemberjibesh3-Feb-13 21:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.140922.1 | Last Updated 22 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid