locked
Binding data with Object Data Source using LINQ RRS feed

  • Question

  • User-303769880 posted

    Hi,

    While I was binding data with Object Data Source (ODS) using LINQ. I encountered an error while including "using System.Data.Linq" in Database1.designer.cs where my database name is Database1 that "Using directive is unnecessary. The type or namespace name 'Linq' does not exist in the namespace System. Data (are you missing an assembly reference)". I have also included the reference to System. Core, as it was written in Microsoft documentation But, was unable to resolve. Not to mention, I have installed LINQ from individual components "LINQ to SQL tools". Please help me out in rectifying this error, I am stuck here for days.

    Thanks in advance

    Friday, June 12, 2020 9:17 PM

All replies

  • User409696431 posted

    "I have also included the reference to System. Core, as it was written in Microsoft documentation"

    What documentation are you referring to?  And what framework and version are you using?

    Saturday, June 13, 2020 2:39 AM
  • User-303769880 posted

    Hi,

    I am using dotnet --version of 3.1.301 and target framework in vs 2019 Web.config file is 4.7.2

    I surfed through the internet and found that after including System.Core.dll this problem may be solved and it may not be the Microsoft documentation which I was referring.

    https://forums.asp.net/t/1264863.aspx?The+type+or+namespace+name+Linq+does+not+exist+in+the+namespace+System+Data+are+you+missing+an+assembly+reference+

    In the above forum, I found that I have to include some sort of assembly. Kindly please help me out with this.

    Thanks in Advance.

    Saturday, June 13, 2020 11:17 AM
  • User475983607 posted

    As far as I can tell you built a Core 3.1 site.  Core 3.1 is not compatible with .NET 4.7.2.

    Saturday, June 13, 2020 12:01 PM
  • User409696431 posted

    Adding to what mgebhard said, you posted this in the Web Forms section.  Core does not support Web Forms.  Some clarification is needed on what you are really doing.

    Saturday, June 13, 2020 9:16 PM
  • User288213138 posted

    Hi naresh99,

    I am using dotnet --version of 3.1.301 and target framework in vs 2019 Web.config file is 4.7.2

    I surfed through the internet and found that after including System.Core.dll this problem may be solved and it may not be the Microsoft documentation which I was referring.

    You can refer to this link about how to create LINQ to SQL classes in a web project.

    And you can also try to modify your .NET framework  version to 4.0 in the application of the project properties.

    If you can't solve the problem, please post your web.config file.

    Best regards,

    Sam

    Monday, June 15, 2020 2:20 AM