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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:43:47+00:00 2026-05-16T21:43:47+00:00

I have a dataset. I added a column Tags. I need to run a

  • 0

I have a dataset. I added a column “Tags”. I need to run a function to update the value, for each row one at a time, for the “Tags” column. Here’s what I’ve tried so far, tell me what I’m missing.

public System.Data.DataSet PopulateDataGrid(int nViewMode)
{
  System.Data.DataSet ds = _data.GetGridView(nViewMode)
  ds.Tables[0].Columns.Add("Tags", typeof(string));

  foreach (System.Data.DataRow dr in ds.Tables[0].Rows)
  {
    dr.BeginEdit();
    dr.ItemArray.SetValue(_dataFactory.GetPartTags(_dataFactory.ExecuteScalar("SELECT POSITION FROM PARTS WHERE PART_ID = " + dr.ItemArray.GetValue(0)).ToString()), dr.ItemArray.Length - 2);
    dr.SetModified();
    dr.EndEdit();
    dr.AcceptChanges();
  }

  ds.AcceptChanges();
  return ds;
}

Yeah, I know I could put using System.Data and wouldn’t have to put it in my code, but this is the only function out of many using that, so I didn’t want to do that (if there’s no damage to loading time, then I may). I wish I just needed to run a query and that’s it, but this needs to be filled in code. If someone could help, that’d be great. Thanks.

Edit: And I’ve also verified that _dataFactory.GetPartTags(_dataFactory.ExecuteScalar("SELECT POSITION FROM PARTS WHERE PART_ID = " + dr.ItemArray.GetValue(0)).ToString()) returns the value I want. It just shows up blank in the DataGridView. The column is there, but nothing is populated.

  • 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-16T21:43:48+00:00Added an answer on May 16, 2026 at 9:43 pm

    You should be able to just use:

    dr["Tags"] = _dataFactory.GetPartTags(_dataFactory.ExecuteScalar("SELECT POSITION FROM PARTS WHERE PART_ID = " + dr.ItemArray.GetValue(0)).ToString())
    

    You should take note that the SetModified() method marks the row as modified, and AcceptChanges() clears the Modified/New/Deleted flags. Unless you have underlying code to store that data somewhere or do something more with it automatically, it’s a little redundant. Same thing with the ds.AcceptChanges(). And if you try to use an adapter later on modified/new rows to push them to the database after you’ve done an AcceptChanges() on the rows/dataset, they won’t be found as modified/new/deleted, and the changes won’t be pushed to the database.

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

Sidebar

Related Questions

I have a script that appends some rows to a table. One of the
i have a input tag which is non editable, but some times i need
I have a project that adds elements to an AutoCad drawing. I noticed that
I have a new web app that is packaged as a WAR as part
I have several USB mass storage flash drives connected to a Ubuntu Linux computer
I have a snippet to create a 'Like' button for our news site: <iframe
I have found this example on StackOverflow: var people = new List<Person> { new
I have a login.jsp page which contains a login form. Once logged in the
Let say I have the following desire, to simplify the IConvertible's to allow me
I want to have generalised email templates. Currently I have multiple email templates with

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.