473,385 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Edit a row

Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDataTable(GetSql(uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay

Sep 19 '06 #1
5 5673
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@gmail.com" wrote:
Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDataTable(GetSql(uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay

Sep 19 '06 #2
Jay
I am updating the rows by getting values from another array. the array
is not sorted. I am not sure in which order the array will have
data.therefore i need to read the data from array and update the
corresponding row in the table.
any suggestions
thanks

Kerry Moorman wrote:
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@gmail.com" wrote:
Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDataTable(GetSql(uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay
Sep 19 '06 #3
Jay,

You could sort both the datatable and the array on the same data element.

Or you could create a dataview from the datatable and use its Find method to
find the row that matches data from the array.

Kerry Moorman
"Jay" wrote:
I am updating the rows by getting values from another array. the array
is not sorted. I am not sure in which order the array will have
data.therefore i need to read the data from array and update the
corresponding row in the table.
any suggestions
thanks

Kerry Moorman wrote:
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@gmail.com" wrote:
Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDataTable(GetSql(uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay
>
>

Sep 19 '06 #4
Kerry,

You are using a strongly typed datatable, that one is forever inherited from
a non strongly typed datatable

The main format of that is that it are two collection.
DataRows
DataColumns

DataRows have items which are described in the datacolumns.

You can forever get an item as
DataTable.DataRows(TheRowIndex).Item(TheDataColumn Name or the "DataItemname"
or the Index)

This patern is of course as well in the strongly dataset. Most people don't
like to use the strongly typed datsets to do updating as you do, because
getting the right row is forever troublefull. Therefore cast it to a
standard datatable and use that.

I hope this gives an idea,

Cor

"Kerry Moorman" <Ke**********@discussions.microsoft.comschreef in bericht
news:AF**********************************@microsof t.com...
Jay,

You could sort both the datatable and the array on the same data element.

Or you could create a dataview from the datatable and use its Find method
to
find the row that matches data from the array.

Kerry Moorman
"Jay" wrote:
>I am updating the rows by getting values from another array. the array
is not sorted. I am not sure in which order the array will have
data.therefore i need to read the data from array and update the
corresponding row in the table.
any suggestions
thanks

Kerry Moorman wrote:
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@gmail.com" wrote:

Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDataTable(GetSql(uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay



Sep 20 '06 #5
Jay
thanks people i fixed the problem. I appreciate everyone's feedback
Jay
Cor Ligthert [MVP] wrote:
Kerry,

You are using a strongly typed datatable, that one is forever inherited from
a non strongly typed datatable

The main format of that is that it are two collection.
DataRows
DataColumns

DataRows have items which are described in the datacolumns.

You can forever get an item as
DataTable.DataRows(TheRowIndex).Item(TheDataColumn Name or the "DataItemname"
or the Index)

This patern is of course as well in the strongly dataset. Most people don't
like to use the strongly typed datsets to do updating as you do, because
getting the right row is forever troublefull. Therefore cast it to a
standard datatable and use that.

I hope this gives an idea,

Cor

"Kerry Moorman" <Ke**********@discussions.microsoft.comschreef in bericht
news:AF**********************************@microsof t.com...
Jay,

You could sort both the datatable and the array on the same data element.

Or you could create a dataview from the datatable and use its Find method
to
find the row that matches data from the array.

Kerry Moorman
"Jay" wrote:
I am updating the rows by getting values from another array. the array
is not sorted. I am not sure in which order the array will have
data.therefore i need to read the data from array and update the
corresponding row in the table.
any suggestions
thanks

Kerry Moorman wrote:
Jay,

You could use a For Each loop to process each row.

For Each dr As DataRow in dt.Rows
'Process row dr
Next

Kerry Moorman
"ja**********@gmail.com" wrote:

Hi,
I am a vb.net novice. I have a datatable which is populated with the
data from sql query.
dt = datastore.GetDataTable(GetSql(uid, bin))
I want to edit each row in the datatable with new values but before
they are binded to the datagrid. what would be the best way to do it.
Any leads would be great
thanks
Jay
>
>

Sep 25 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: dixie | last post by:
I have some code that adds new records into a table for each ID in a list box when a button on a form is clicked. This works fine. My problem now is that I wish to be able to edit all the records...
2
by: Sky | last post by:
Hello: Another question about trying to wring functionality from a DataGrid... Have a DB table of "Contacts" -- 14 or more fields per record Show in datagrid -- but only 5 columns (First,Last,...
4
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml...
3
by: Schultz | last post by:
is there an easy to follow, source code in one document, article that explains how to create an edit all DataGrid control? and, I have a DataGrid setup where the client enters information for...
8
by: =?Utf-8?B?bWlrZWc=?= | last post by:
Hi, I am building a small Help Desk application for my company and need to be able to edit "open" help desk issues. I use a simple datagrid to display each issue (6 per page) , with an Edit...
1
by: ollielaroo | last post by:
Hi guys, Firstly I did do a search for this one first but I couldn't find anything related in this forum. I am using Dreamweaver MX and trying to build admin pages for an ASP site. My problem is...
1
by: Anette | last post by:
I found the FAQ: I can't find any "edit" button by my post. The FAQ says "Your ability to edit your posts may also be time-limited, depending on how the administrator has set up the forum." I...
5
by: Ryan Liu | last post by:
I have this problem: "cannot continue edit while debug in VS2005". I see the same tread after I search this topic in google, but none solutions works for me. So again, I ask here. Can someone...
1
by: rogerford | last post by:
I have a grid which i bind with values from Database. I have events to edit and update the grid. I am not using SqlDatasource to connect to DB. Rather i am doing the updating of the grid...
1
by: chromis | last post by:
Hi, I'm having trouble fully implementing the edit section of a contact admin system, so far I have written the following: - Bean (Contact.cfc) - Data Access object (ContactDAO.cfc) - Gateway...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.