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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:40:33+00:00 2026-06-01T09:40:33+00:00

Using C# .net 4.0 and visual studio 2010. I need to update a table

  • 0

Using C# .net 4.0 and visual studio 2010.

I need to update a table on my server with a table that is generated in my code.

I’m having difficulty figuring out what I need to do.

Do I need to update or do I need to create a temp table with and insert? or something totally different.

public void SaveMyWorkI()
{
    DataGridViewRowCollection coll = ParetoGrid.Rows;

    saveTable.Columns.Add("Part", typeof(string));
    saveTable.Columns.Add("Pareto", typeof(string));

    foreach (DataGridViewRow item in coll)
    {
        saveTable.Rows.Add(item.Cells[2].Value, item.Cells[5].Value);
        //saveTable.Rows.Add(item.Cells[5].Value);
    }

    MyErrorGrid.DataSource = saveTable;

    //SqlCommand pgINSERT = new SqlCommand("INSERT or UPDATE", conn);

}

The update would inner join on part.

As you can see I just did this and now my mind has gone blank. Not only that but this is the last major part to the small program.

Here’s what i have so far:

foreach (DataGridViewRow item in coll)
        {
            saveTable.Rows.Add(item.Cells[2].Value, item.Cells[5].Value);

            part = item.Cells[2].Value.ToString();
            pareto = item.Cells[5].Value.ToString();

            SqlCommand pgINSERT = new SqlCommand("UPDATE dbo.OldParetoAnalysis SET part = " + part + " , pareto = " + pareto + "", conn);
            pgINSERT.ExecuteReader();
            //saveTable.Rows.Add(item.Cells[5].Value);
        }

Error I’m getting is “Invalid column name 'BK177'“, BK177 is my data from my 1st row 1st column.

  • 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-01T09:40:34+00:00Added an answer on June 1, 2026 at 9:40 am

    so basically you have a DataTable with data and you want to insert all its content on the DB?

    You didn’t say which version of SQL Server you are using but if you are using 2008, there is a table valued parameter type that you can use to send a whole table to a procedure for example. Then you could read this table on the proc and do whatever you need to do with it.

    References:
    http://msdn.microsoft.com/en-us/library/bb510489.aspx

    http://msdn.microsoft.com/en-us/library/bb675163.aspx

    http://blog.sqlauthority.com/2008/08/31/sql-server-table-valued-parameters-in-sql-server-2008/

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

Sidebar

Related Questions

Using: Microsoft SQL Server 2008 Microsoft Visual Studio 2010 C# .NET 4.0 WinForms Ok
I have a asp.net website with c# code behind and using visual studio 2010.
Using SQL, SQL server manager 2008, c-sharp.net 4.0 and ms visual studio professional 2010:
I'm using Visual studio 2010 and .NET Framework 4.0. Code: public void LoginTo(string username,
I'm using asp.net(C#) under visual studio 2010 I have a panel that is by
I'm using C#.net 4.0 with Visual Studio 2010. I am getting the error Error
I'm using Visual Studio 2010 with VB.NET, in a 4.0 project, with Team Foundation
I'm using Visual Studio 2010 RTM with .NET/Entity Framework 4 RTM with a model
I'm using the Visual Studio 2010 RC for .NET 4.0 and I'm trying to
I'm using Entity Framework in Visual Studio 2010 Beta 2 (.NET framework 4.0 Beta

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.