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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:11:02+00:00 2026-06-06T02:11:02+00:00

I have fetched some data from a SQL database into a datagridview, but after

  • 0

I have fetched some data from a SQL database into a datagridview, but after the user modified the data in the datagridview, how can I upload the data back?

And also, I found a code like this:

this.dataGridView1.Update();

What does this method Update? Here is the code where I bind the data to datagridview:

SqlDataReader read;
SqlCommand cmd;
DataTable dt = new DataTable();
cmd = new SqlCommand("Select * from Table", 204.192.49.3);
read = cmd.ExecuteReader();
dt.Load(read);
dataGridView1.DataSource = dt;
  • 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-06T02:11:04+00:00Added an answer on June 6, 2026 at 2:11 am

    The easiest way is to create a temporary DataSet, fill it with data using a SqlDataAdapter and then passing it as dataGridView’s DataSource. This code should do the trick:
    DataSet temp = new DataSet();
    SqlDataAdapter SDA = new SqlDataAdapter();
    SqlCommand command = new SqlCommand();
    SqlConnection connection = new SqlConnection();
    string connstring = "YourConnectionString";

    And then in the method you want to trigger the update do this:

    `connection.Open();
     command.CommandText = "SELECT * FROM Table" //Adjust the SQL query to your needs
     command.Connection = connection;
     SDA.SelectCommand = command;
     SDA.Fill(temp);
     dataGridView1.DataSource = temp.Tables[0].DefaultView;`
    

    This should solve your problem.

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

Sidebar

Related Questions

I have a function which performs some operation i.e. fetches some data from database.
I have fetched some records from core data, and presented it in a table
I have a widget that shows some data fetched from the Internet. I may
I have a silverlight 3 application, that fetches some simple data from a ms-sql-server
I have compared two queries which fetch some fairly large data from a database
I have a repeater which fetches data from a database and shows some labels
I have an activity which displays some data fetched from the server. If no
I have some Core Data entries which are all fetched and thrown into an
I have a Python script that for-loops through some objects and fetches data from
I have fetched a result from core data in my app and need to

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.