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

  • SEARCH
  • Home
  • 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 7822111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:49:53+00:00 2026-06-02T07:49:53+00:00

I’m brand new to binding datagridviews to datasets. I have a created a dataset

  • 0

I’m brand new to binding datagridviews to datasets. I have a created a dataset and (I think) filled it with a table from a sql server DB. But when I try to fill the datagridview, it only shows a blank, 7-column table with column headings like Column1, Column2 etc. I’m sure I’m missing something silly, but don’t where to begin to look. Anybody see what’s wrong?

  • Worth mentioning: the table on sql server is not blank.

  • Adding initializeComponent does not solve it, like in this post DataGridView Rows Empty when set to DataSet

Edit
It seems like my dataset is not getting filled. Dataset1.tables(0) has no rows in it. From the GUI it looks like there is something called AverageWeeklyLabsTableAdapter (see photo below). I guess I assumed datasets worked like LINQ to SQL where the object is just filled with the data automatically, but maybe you need to call code to fill the dataset?

The on load event…

    Dim myBindingSource As BindingSource = New BindingSource
    myBindingSource.DataSource = DataSet1.Tables(0) //has no rows
    DataGridView1.DataSource = myBindingSource
    DataGridView1.ReadOnly = True

The dataset

enter image description 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-02T07:49:54+00:00Added an answer on June 2, 2026 at 7:49 am

    When I load data to a datagridview, I use a BindingSource but from your limited code it doesn’t look like you are doing that.

    So you would Fill your DataSet with the table data then load your BindingSource with your data, similar to this (code shortened for brevity):

    dataAdapter.Fill(table); 
    bindingSource1.DataSource = table;
    datagridview1.DataSource = bindingSource1;
    

    Based on your EDIT it doesn’t appear that you are actually populating your data. You have to use the Fill from the table adapter to get the data from the database. Also, .net will expect a specific object-type for the datatable (based on the dataset) Kind of like this:

    var adapter = new AverageWeeklyLabsTableAdapter();
    var dataTable = new myForm.DataSet1.AverageWeeklyLabsDataTable
    adapter.Fill(dataTable);
    bindingSource1.DataSource = dataTable;
    datagridview1.DataSource = bindingSource1;
    

    Here is another question on SO about tableadapters:

    What do C# Table Adapters actually return?

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

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.