0

I have a rather confusing issue.

I've recently picked up some code I wrote 8 months ago in VS Web Developer 2008. Ive now moved on to 2010, so I upgraded the project, but otherwise it's the same. It now won't build because of code like below:

IMSDataSet.vwPartDataTable table = new IMSDataSet.vwPartDataTable();
        da.Fill(table);

        //Convert to Parts
        return table.Select<IMSDataSet.vwPartRow, Part>((row) => { return new Part(row); }).ToArray();

Where vwPartDataTable is created using the Data Set designer in Visual Studio. Now having a look around on SO it appears that this is incorrect code, and I need a AsEnumerable() in there. However the thing is. I deployed this code. There's load of these lines, I used them everywhere, so it must have worked.

The project upgrade moved everything to .NET 4.0, but putting it back to 3.5 had no effect.

Can anyone shed any light. I'd prefer to keep the code exactly as it was because that is what the customer has.

Thanks.

Wilco
  • 974
  • 8
  • 14

2 Answers2

0

If that was a .Net 2.0 feature, you can target that framework version in Visual Studio 2010 if you take an extra step described in this popular SO question.

Community
  • 1
  • 1
DOK
  • 32,337
  • 7
  • 60
  • 92
0

To answer this. I had incorrectly installed some SQL component. I got an error when trying to open my .xsd (the drag-and-drop data table designer), involving a missing package. This fed down into the custom tool generating old or basic code that didn't include generics support, therefore the generic LINQ functions I used weren't available.

Fixing this required uninstalling Visual Web developer and .NET 4, then re-installing. I also installed SQL Server 2008 R2 express separately instead of letting the Visual Web Developer (VWD) installer do it. This is what I've done previously as well.

Wilco
  • 974
  • 8
  • 14