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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:42:35+00:00 2026-05-25T01:42:35+00:00

IN the following code sample, I want to update the table but it’s not.

  • 0

IN the following code sample, I want to update the table but it’s not. it is Updating my datagrid. I want the description to be ‘Care’ on the table. This is just a sample project to learn how to use the datasets.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class _Default : System.Web.UI.Page
{

SqlCommand cmd;
SqlDataAdapter da;
DataSetPK ds;
protected void Page_Load(object sender, EventArgs e)
{
    SqlConnection cn = new SqlConnection("server=ORDERS;uid=OG;pwd=OG;database=PRO2");
    cmd = new SqlCommand("select * from [OG].[TAP_C_ROOM_TABLES]", cn);
    da = new SqlDataAdapter(cmd);
   // dsProducts tds = new dsProducts();
    ds = new DataSetPK();

    da.Fill(ds, ds.TAP_C_ROOM_TABLES.TableName);

    dgok.DataSource = ds;
    dgok.DataBind();

   }
    protected void btnInsert_Click(object sender, EventArgs e)
    {


    DataRow row = null;
   // DataSetPK ds = new DataSetPK();
    row = ds.TAP_C_ROOM_TABLES.NewTAP_C_ROOM_TABLESRow();
    row[0] = "T1";
    row[1] = "a";

    row[2] = "test";
    ds.TAP_C_ROOM_TABLES.BeginInit();
    ds.TAP_C_ROOM_TABLES.Rows.Add(row);
    ds.TAP_C_ROOM_TABLES.EndInit();
    ds.TAP_C_ROOM_TABLES.AcceptChanges();
    ds.AcceptChanges();

    da.Update(ds.TAP_C_ROOM_TABLES);

    da.Update(ds, ds.TAP_C_ROOM_TABLES.TableName);


    dgok.DataSource = ds;
    dgok.DataBind();


    }
   protected void btnUpdate_Click(object sender, EventArgs e)
    {
    ds.TAP_C_ROOM_TABLES.Rows[0][2]="Care";
    ds.TAP_C_ROOM_TABLES.AcceptChanges();
    ds.AcceptChanges();
    da.Update(ds, ds.TAP_C_ROOM_TABLES.TableName);

    dgok.DataSource = ds;
    dgok.DataBind();

    }
   }
  • 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-25T01:42:35+00:00Added an answer on May 25, 2026 at 1:42 am

    If you want to update the table, you will have to run the SQL query for it.

    And if you are using SQL server, I think the SQL command to rename a column would be

     sp_RENAME 'TableName.[OldColumnName]' , '[NewColumnName]', 'COLUMN'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this sample console app I want to update a row in a table,
I have the following sample code which doesn't seem to want to run. import
I have the following code (just as a test) and I want to create
I want to code a simple form layout in flex. Something like the following:
The goal of the following code sample is to read the contents of $target
Given the following code sample: uint8_t i, in, ni; i = in = 2;
I have the following code sample that im trying to wrap my head around
I have the following sample code in a VB.NET console application. It compiles and
I have a Dictionary bound to DataGridView by using following sample code. DataGridView bound
I am new to Emacs, and I have the following code as a sample.

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.