.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Linq forward compatibility issue

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :ASP.Net
In Linq 3.5 I used to be able to do this, but the code in bold is no longer compatible in Linq 4.0, Is there another way to declare the query variable prior to assigning it (PLEASE DO NOT SUGGEST TO DECLARE AS VAR, IT DOES NOT WORK AND CAN NOT BE DECLARED AS NULL):   ProjectArtifactsDataContext dbProjectAttributes = new ProjectArtifactsDataContext();IQueryable<ProjectArtifacts.Defect> query1 = null;   This type of declaration allowed me to create aggregate and complex queries such as         if (UserControlHost.ShowMyItemsOnly)        {            Guid currentUserId = (Guid)Membership.GetUser(Membership.GetUser().UserName).ProviderUserKey;            query1 = dbProjectAttributes.Defects.Where(defect =>                 defect.Active == true && defect.AssignedTo == currentUserId);        }         else        {            if (FilterInactive == true)                que

View Complete Post

More Related Resource Links

Compile issue with List<> and Linq

I am pretty sure this is some framework version issue but I am getting this on a (custom layout) page compile migrated over from MOSS. The following code complies in my MOSS 2007 environment but does not in my new 2010 environment. Thanks in advance for any help. Code section #1: private bool isSuccessReturnCode(string s) { bool bReturn = false; // Following line fails looking for ';' XDocument loaded = XDocument.Parse(s); var q = from c in loaded.Descendants("Node") select (string)c.Element("ReturnCode");   Code Section #2 private InvoiceItem getInvoiceItem(Guid ID) { List<InvoiceItem> InvoiceItems = ((List<InvoiceItem>)ViewState["INVOICEITEMS"]);

Compatibility issue between Job and SSIS Pacakge

HI All, I have created package in SSIS which process the cube in Incremental mode,but what problem i am facing when i run the package first,its runs successfully but not updated the cube while when i run the package secind time it upload the data in to the cube and this happens regulrly. This happens with processing mode too.  Kindly Suggest what mistake i have commited.   Shraddha  

Outer join operators *= and =* are not supported in 90 or later compatibility modes Upgrade issue

Hi all In processes of upgrading SQL Server 2000 to SQL Server 2008 I held up with one issue I am not a good pragrammer If some helps me how to modify this query,realy it help for me. "Outer join operators *= and =* are not supported in 90 or later compatibility modes" Here this query SELECT Brnd.Name, Dev.Devype FROM Prd,PrdRel, Rel, RelVer, DevSoft, DevCla, Dev, Brnd,OVer WHERE Prd.ID = PrdRel. Product AND Rel.ID = PrdRel.Release AND RelVer.Release = Rel.ID AND DevSofte.ReleaseVersion = RelVer.ID AND DevSoft.DeviceClass = DevCla.ID AND DevCla.ID = Dev.DeviceClass AND Brnd.ID = Dev.Brand AND OVer.ID =* Dev.OSVersion AND RelVer.Latest = 'Y' AND Prd.ID = @Product AND Rel.OS IN (@OS) Please some help me how to code  to come out from the problem. your help going to be greate for me.  SNIVAS

LINQ to SQL Compact db, file copy issue

Our application uses LINQ and SQL compact database .sdf file as datasource.  It is using Miscrosoft SQL Server Compact 3.5 SP 1 and .NET Framework 3.5 SP1. We store our application's project data into a .sdf file.  When our application opens a .sdf file (e.g. projectA.sdf), it will make a temporary copy of it and open the temporary file instead of the original file.  If we change one table cell value (i.e. one property value of an object that is created by LINQ), and call DataContext.SubmitChanges(ConflictMode.ContinueOnConflict), and then call File.Copy(DataContext.Connection.Database, filename, true); to copy the temporary file back to the original file (replacing the original one).   We found that the table value is not changed in projectA.sdf.  But in the temporary copy, the value is changed.  If we re-open db connection by calling DataContext.Connection.Close(); DataContext.Connection.Open(); right before calling File.Copy(), the changed value is copied successfully to projectA.sdf. If we do a lot of value changes in the database, or adding / deleting table row, then submit changes.  Without re-opening the db connection, after File.Copy(), the projectA.sdf have those changes copied. This strange behaviour looks like the temporary db file is cached.  For a small change, the cached version is not changed.  The File.Copy() use t

Browser Compatibility Issue : Telerik


Hello everybody.

At the beginning I want to tell that I searched Google to find my solution but I failed.

I am working with Telerik for my college project. But I figure that there is a browser compatibility issue arise.  I am showing a table layout of Login Control :

<asp:Login ID="Login1" runat="server" OnLoggedIn="Login1_LoggedIn">
											<table cellpadding="2px" style="margin-left:auto; margin-right:auto">
													<td align="center" colspan="2">
														<asp:Label ID="LoginLable" Font-Underline="true" runat="server" ForeColor="Black"
															Text="Log In">
													<td align="left">
														<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" ForeColor="Black"
															Text="User Name:"></asp:Label>
													<td align="right">
														<telerik:RadTextBox ID="UserName" runat="server" Skin="Custom&q

Compatibility issue between Job and SSIS Pacakge


HI All,

I have created package in SSIS which process the cube in Incremental mode,but what problem i am facing when i run the package first,its runs successfully but not updated the cube while when i run the package secind time it upload the data in to the cube and this happens regulrly.

This happens with processing mode too. 

Kindly Suggest what mistake i have commited.




LINQ to SQL Classes (dbml file) across multiple websites issue



I have a single LINQ to SQL Classes (dbml file) compiled in a Class Library that's referenced by 3 websites. Inside that Class Library there's also a class that's using the DBML to manipulate data.

At one point it needs to save in a user table the user info (firstname, lastname, email). SOMEHOW (!?) two of the 3 webapps saves email instead of firstname and viceversa while the other 1 saves them correctly ! The one compiled last seems to be the one saving correctly.

There's no code error as I have debugged this multiple times. The values are assigned correctly but before the SubmitChanges() call the data inside the database object is corrupted.

Now, I have already fixed this locally by putting every website in a separate AppPool (which also needs to be set to "Classic" and not "Integrated". However I really don't want to bug the client with such IIS changes so I'm looking for another workaround !

Please Help!



Linq to Entities Many to Many Persistence Issue


I am having problems persisting a many to many. My code saves the Problem but not the users that can be attached to a problem. My Linq to Entities Mapping is below in the first three code blocks. I then have my ASP MVC controller method which receives a problem, a file (optional), and a string array of users which are allowed to view the problem. I retrieve the Users from the UserRepository and add them to a List which is then passed through to the ProblemRespository with the problem and added to the problem.Users collection. However when submitted only the problem is being saved and not the records which are required in the junction table. Any help would be appreciated. This is the first time I've attempted my own mapping.
Thanks in advance.

SharePoint 2007 and MS Office 2010 Compatibility issue


I have MOSS 2007 and MS Office 2007.When i select new document(document template) from document library  and save it then it save to document library.

But when i upgrade MS Office 2007 to MS Office 2010 and save any document then document save locally instead of particular document library.

please suggest if u have any idea.

Mukesh Ajmera

Browser compatibility Issue while using autocomplete extender in asp


how to set the comaptibility for browsers in an asp.net page

i have used the following code in my master page but its only working for IE not for FF or other browsers.

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

Can any one help please

Linq Float/Double Issue


I'm using linq to sql, and everything seems to be working fine except one thing, I'm showing any mapped float fields from my db tables as "Double?" instead of "Double", and when binding to a datagrid, any of those "Double?" fields don't show.

If I iterate through the items and spit out the property, the float value is indeed there and properly returned.  What's going on here?

LINQ To SharePoint - SPMetal Issue


Hi All,

We an issue with LINQ to SharePoint in creating entities class. Whenever i created the entities class using SPMetal, one or more columns are automatically created in RemoveColumnAttribute something as shown below.

    public override string Status
        throw new System.InvalidOperationException("Field WorkflowPRStatus was removed from content type.");
        throw new System.InvalidOperationException("Field WorkflowPRStatus was removed from content type ");

Could anyone faced this issue and how to get rid of this Remove


Any suggestions are welcome.


Chandrasekaran C N

Chandrasekaran C N

LINQ to XML Query Issue



I wanted to retreive "Summary" attribute from following XML using LINQ to XML. Contract and Cancellation fee are working fine. Getting issue in discount. help will be  appreciated.

 var res = from feed in doc.Descendants("pp")
          where feed.Attribute("code").Value == "XYZ-ABC-00"
         select new


            Con_Summary = feed.Element("contract_term").Attribute("Summary").Value,

            Can_Summary = feed.Element("cancellation_fees").Element("cancellation").Attribute("Summary").Value,

            Dis_Summary = feed.Element("discounts")



<pp code="XYZ-ABC-00" >

    <fuel_types elec="true" gas="true" dualOnly="false" />

    <contract_term period="months" Summary="3 Year Contract">36</contract_term>

SQL Server Compatibility issue with application


Hi Expert's,


Recently we have migrated one SQL Server from 2000 to 2005. After migration application become slow and not functioning properly. So we made a root cause analysis and find that due to database only they face such a issue. So i export all the tables to new database and done all the performance tuning like index rebuilting ect,. But we notice that issue should be still remain. So kindly suggust is there is any more settings we need to be change in SQL server side or not.


Note:- application is working well in SQL Server 2000.

Issue faced in application side. Consider its a token generation application toughs who wait in the line(Same like bank cash counter token). We have around 10 counter is there. When ever they log in one counter other 9 counter application is showing as server busy.

Thiru - MS SQL World Regards, RM Thirunavukkarasu MCP, MCITP, ITIL V3 | "http://thiruna.blog.com" |Click "Propose As Answer" if solution is helpful to you.

system.linq.enumerable.where Issue



I have a table "OSTAN" with two columns "ID" (Key index) and "NAME". I am trying to  construct a linq query to select the Name for a specific ID. I have not luck trying to construct the where clause. Here what I have so far:


using (XeledsEntities db = new XeledsEntities())
            string SelectedName = db.Ostans.Name.Where( Ostan=> Ostan.Equals(Request.QueryString["Ostan"])).FirstOrDefault(); 


Can anybody help me construct this where clause to set the Selected Name?

LINQ "connection is closed..." issue



I am having trouble navigating through the forums to locate a LINQ forum so I am posting here.  Please excuse my error if this is incorrect.  I have been using LINQ for about 2 years and have not encountered this problem before.  Reference the attached snippet.  Note that during execution of the "foreach" loop, in the debugger at least, an error, "...connection is closed..." is thrown.  I suspect that I am making a stupid mistake but cannot locate it.  Oh, I am using VS2010 and C#. 

Playing with Linq grouping: GroupByMany?

One of its features is grouping. Many people understand grouping like it is defined in Sql. Linq is implementing grouping quite the same way. Let's discover this syntax and how to make consecutive groups easier.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend