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


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

            For Each User In People ' <----------- Error
        Catch ex As Exception
        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...

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.

Check out

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

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" />


<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.

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!
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.