how to change data in a DataTable object

I am loading a data table object "MyTable" form a reader object. The reader object was populated with data from a sql stored procedure. All is good, except I want to know if there is a way to change/update the data in my DataTable object "MyTable"?

I would like to change the data before it us used to populate a GridView control

 Dim MyTable as New DataTable()
 Using Command as New SqlCommand(mySqlQuery,connection)
 connection.Open()
 Using reader As SqlDataReader = command.ExecuteReader()
 MyTable .Load(reader)
LVL 2
brgdotnetcontractorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ElrondCTCommented:
Sure. You refer to each row of the table as

MyTable(x)

where x is the row number. You don't have a strongly typed table, so you'd refer to individual columns/fields of the row by either number or quoted name (taken from the database structure):

MyTable(4)(2) means column 2 (starting from 0, so it's actually the third column) in row 4 (again, starting from 0)
MyTable(4)("ID") means the column named "ID" in row 4
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
In addition to ElrondCT's advice:

If you have to make changes to each Row, you can do this:

For each dtr As Datarow in MyTable.Rows
  dtr(0) = "Some Value" << this would update the first column in the row
Next

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brgdotnetcontractorAuthor Commented:
Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.