Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:59:49+00:00 2026-06-13T17:59:49+00:00

I just started teaching myself Linq to SQL today. I hardly know anything about

  • 0

I just started teaching myself Linq to SQL today. I hardly know anything about linq. That being said, I have a query that i want to return a Name from my database. It is a varchar in the DB

var query = from a in FRESH.Customers
            select a.CUSTOMER_NAME;

dataGridView1.DataSource = query;

This results in a gridview with a column named “Length” and displays the length of every name. If I change the query to select a everything displays fine. What am I doing wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:59:50+00:00Added an answer on June 13, 2026 at 5:59 pm

    The DataGridView will by default show all of the properties of the type in the list as columns. Since your query is returning a collection of strings and the only1 “property” of a string is Length it shows that as a column.

    Try changing to

    var query = from a in FRESH.Customers
                select new {Name = a.CUSTOMER_NAME};
    

    1Technically the indexer Chars is a “property” but the DataGridView must be clever enough not to use an indexer as a column.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm teaching myself CIL and have been doing ok so far (just really started
my level of knowledge: i have just started teaching myself PHP and Dreamweaver after
I just started teaching myself C++ on the Mac, and I have run into
Good day, I've just started teaching myself VB.net. I'm trying to create a simple
I'm extremely new to Java, and have mostly just been teaching myself as I
I've just started teaching myself JavaScript and am doing some basic exercises. Right now
Just started mongo and started having issue with querying already. i have a collection
I'm teaching myself iOS 5 programming through the Stamford University CS193P class, I just
When I was first started teaching myself programming, after finishing a tutorial I would
Just started learning PySide and is having problem with QTimer I have this #!/usr/bin/python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.