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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:04:53+00:00 2026-05-28T11:04:53+00:00

I have a database with a few tables running on SQL Server 2008, and

  • 0

I have a database with a few tables running on SQL Server 2008, and I’m programming a Windows app w/ .NET 3.5, using the classes provided to query the server. I’m having an issue with a seemingly persistent “blank” row being included in every table.

For example, I bind a DataGridView to a BindingSource, who’s DataSource is a table constructed by a SqlDataAdapter that connects to my database, and I display the results on my DataGrid. The table has 1 record in it:

dataGridView->DataSource = bindingSource;
bindingSource->DataSource = GetData(
    "Select * From xxxx", Get_DB_String(), dataAdapter );

Where GetData is defined as:

DataTable^ GetData(
    String^ sqlCommand,
    String^ connectionString,
    SqlDataAdapter^ adapter )
   {
      SqlConnection^ Connection = gcnew SqlConnection( connectionString );
      SqlCommand^ command = gcnew SqlCommand( sqlCommand,Connection );
      adapter->SelectCommand = command;
      DataTable^ table = gcnew DataTable;
      adapter->Fill(table);
      return table;
   }

And the following grid is what it produces:

grid

If I check the table->Rows->Count, right after the adapter fills the table, it produces a 1, as does the bindingSource->Count. However, the DataGridView reports 2 rows when checking rows->Count.

Now, if I load the SQL Server Management Studio and look at my table, I’m presented with the following view:

grid

However, the row is not able to be deleted/removed, and if I edit any of the contents of a cell in a row it simply adds a new entire NULL row. I assume this is by design for some purpose I’m not aware of, but I’m also hung up on this being the issue.

If I try to explicitly delete the row from the DataGridView, it returns a: “Uncommitted new row cannot be deleted”, and I can’t try to remove the row from my table after filling it with the SqlDataAdapter because it doesn’t report it as being there.

This problem is wreaking havoc on not only the aesthetics of the app, but also the functionality, because I can’t run routines on a bound DataGridView with data that doesn’t exist.

I hope I was being concise enough to convey my problem. Thank you.

  • 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-05-28T11:04:54+00:00Added an answer on May 28, 2026 at 11:04 am

    This row is for inserting new records in your dataset. If you leave it blank then it just stays blank. If you start editing it – it waits for the edit to finish (when you set focus out of this row) and adds a new record with specified field values.

    If you want to disable this functionality in DataGridView then just set the property AllowUserToAddRows to false, like this:

    dataGridView->AllowUserToAddRows = false;
    dataGridView->DataSource = bindingSource;
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large (100+ tables) SQL Server 2005 database that I would like
We have a legacy database which is a sql server db (2005, and 2008).
So I have a database with a few tables. The first table contains the
I have a MS Access database with few tables and a form. When more
I have several database tables that just contain a single column and very few
In my database, I have a few columns in one of my tables that
I have a few classes, such as those that outline database table structure or
I have a few ASP.Net database front-end websites where MS Access is the back-end.
We have built a large database model (SQL Server) for our client and an
We have a giant SQL Server 2005 database (75GB) which basically is just data

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.