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 60115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:06:41+00:00 2026-05-10T18:06:41+00:00

I have a project here that connects to an in-production database and grabs tables

  • 0

I have a project here that connects to an in-production database and grabs tables and views. The code I’ve inherited connects to a SQL Server database via a SqlConnection, with the user’s provided credentials and the database location they provide. When data is required, it uses the connection and a SQL string to create a SqlDataAdapter, and fills a brand new DataSet. That data then gets displayed after manipulating it, replacing table column names with appropriate display names, that sort of thing.

Problem is, the entire process is slow, and the icing on the cake is that it displays large amounts of data in ListViews, which do not take kindly to being given ten thousand rows of data. For design reasons, we’re not going to be breaking into pages – there is a search control – and I can implement a virtual ListView at great effort to simply get back to where I was. I simply think this is the wrong application for ListViews – I’m connecting to a database, and I’m displaying records. Sounds like a job for a DataGridView.

Sadly, it simply won’t work. I’m trying to bind the DataGridView to the DataSet I’ve gotten from the connection code via a DataBinder, but when I fire it up to have a look the data’s sitting in the DataSet while the DataGridView is completely empty.

However, if I use the GUI binding on my test database, taking the current database schema and my credentials, lo and behold it works a treat. But I can’t use this stuff, because it’s simply not flexible enough – I don’t want to define a schema in the code that I have to change every time we update the database, and I need access to the connection string, and I don’t seem to get that from the TableAdapter it creates.

Am I missing something simple here to make my DataSet/BindingSource solution work? Am I barking up the wrong tree?

Is it even worth fiddling around with binding anyway? All of the binding stuff I can see seems to get me 90% of the way there, but then I can’t modify the connection string or sort particular columns the way I want, and it seems to want me to give it a defined schema which is going to break as soon as the database changes – whereas the handwritten code is at least defensively designed and quite flexible. I’m not cutting features, and the slow solution already works – if I have to give up on some of my requirements in order to get it to work, we’ll just deal with what we’ve got.

  • 1 1 Answer
  • 2 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. 2026-05-10T18:06:41+00:00Added an answer on May 10, 2026 at 6:06 pm

    It should work fine as long as you have specified the table name (else IIRC the first table is used). Of course, you can simplify things by giving the appropriate DataTable (rather than the DataSet) to the DGV. You might also want to check that auto column-generation is enabled on the DGV. But binding to an ad-hoc DataTable works fine; I use it all the time for examples etc.

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

Sidebar

Related Questions

I have Java code that connects to an SQL server DB but I cannot
I have a java project with many files that connects to the database. Can
I have a gwt project that uses gwt-mosaic. Here is the error message I
Interesting one here. I have an ASP.NET 1.1 project that contains a web service
Its complicated. I have SQL Server 2008 on my production server and the access
I have this project having MSSQL 2008 R2 as its database server. The connection
I have a database that has two fields: current, and previous. Here is the
first I have checked that Server Authentication is already set to: SQL server and
I have a project here the goal is to merge multiple Access DB's into
I have a sample project here on github where I created a c++ wrapper

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.