Linq query: "String must be exactly one character long"

Hello,

This simple Linq query gives me an error "String must be exactly one character long" on the specified line:

        Dim db As New DataClasses1DataContext
        Dim People = From tblPeople In db.tblLogins

        Try
            For Each User In People ' <----------- Error
                MsgBox(User.AuthorID)
            Next
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

If I "Set Next Statement" before the Try AFTER receiving the error it get the content of the database just fine...  

What's going on...

tnx
~j
NCSOAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ChetOS82Commented:
Check out http://dotnetslackers.com/XLinq/re-63043_LINQ_Error_String_must_be_exactly_one_character_long.aspx

You need to change the definition from Char(1) to String in the designer.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NCSOAuthor Commented:
I actually found this article myself but couldn't find anything useful, except the necessary change is in the DBML file instead.

I changed this line:

<Column Name="MI" Type="System.Char" DbType="Char" CanBeNull="true" />

to:

<Column Name="MI" Type="System.String" DbType="NVarChar(1)" CanBeNull="true" />

And all is good in the world!

But you got me on the right track, so I'm happy.

tnx
~j
0
NCSOAuthor Commented:
This actually wasn't the answer to my question but got me on the right track.

Check my final comment for the actual answer!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.