LINQ to ADO.NET Intellisense Question (VB9)

  • Thread starter Thread starter JT
  • Start date Start date
J

JT

Hi all,
I am working with LINQ in Framework 3.5 in a VB9 Windows Forms 2.0 project.
My compile options include strict ON, explicit ON, and Infer ON. My
references include System.Core, System.Data.DataSetExtensions, System.Data
and System.XML. My app targets the 3.5 framework. I am using VS2008 VSTD.

I would like to be able to use syntax like:

Dim q = From dRow In MyStronglyTypedDataTable Where
dRow.MyIntegerDataColumnName= 12345

Instead, I am having to use the following syntax:

Dim q = From dRow In MyStronglyTypedDataTable Where
CInt(dRow!MyIntegerColumnName) = 12345

As you can see, I cannot seem to get the intellisense from dRow that should
come from a strongly typed datatable. Instead, I just the options for a
standard datarow and have to do the unboxing operation on an object.

Can someone please tell me what I am doing wrong or missing?
Thanks.

John
 
Hello,

I tried to repro this but it works fine. Please *always* include the exact
error message you get (the message shown by the compiler when using the
first syntax). I assume the message wrapped the line (else you would have to
use _ to have your LINQ statement on multiple lines). If you don"t have any
message it could be just an intellisense issue...
 
Thank you Patrice. The issue is not one of a missing line continuation.
Also, no compiler or runtime error message is thrown. I just cannot get the
intellisense to work...
 
Actually, I could be more helpful...
If I exchange the ! for a . in my code, I get the compiler error that
"MyTypedDataColumnName" is not a member of datarow.
 
PROBLEM SOLVED!!

This was a project that I was upgrading from NET 2.0. It seems that my
reference to System.Data was somehow corrupted. I noticed that other
projects (data access and business layers) had reference to System.Data,
whereas the UI project referenced System.data (compare case of "data"). This
seemed to point to the right thing in the object browser. Nevertheless, I
added an explicit ref to System.Data.LINQ and, voila, I got my intellisense
on the typed datarow columns and the boxing issue was gone! I then removed
that reference, as well as the reference to System.data, and then re-added
just System.Data. All is now fine. Must be an upgrade issue. Wonder if
anyone else has encountered this?
JT
 
Hello John,
Thanks for your reply.

It sound like VS IDE failed to load System.Data assemble. Re-adding the
reference resolves the issue. We haven't met the same issue, but I have
some experice in the similar scenario. Sometimes, VS IDE Intelligence
doesn't work fine. We need to re-add the assemble. Therefor VS IDE will
reload the assemble again. Thanks for sharing this information with us. I
think others may get benefit from this. :)

If you have any more concern, please feel free update here again. We are
glad to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top