Home All Groups Group Topic Archive Search About
Author
19 Sep 2006 8:30 PM
jayasunderam
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

Author
19 Sep 2006 9:01 PM
Kerry Moorman
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


Show quoteHide quote
"jayasunde***@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
>
>
Author
19 Sep 2006 9:09 PM
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:
Show quoteHide quote
> 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
>
>
> "jayasunde***@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
> >
> >
Author
19 Sep 2006 10:29 PM
Kerry Moorman
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


Show quoteHide quote
"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
> >
> >
> > "jayasunde***@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
> > >
> > >
>
>
Author
20 Sep 2006 4:12 AM
Cor Ligthert [MVP]
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(TheDataColumnName 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

Show quoteHide quote
"Kerry Moorman" <KerryMoor***@discussions.microsoft.com> schreef in bericht
news:AF6FD686-CB18-45C4-A7A8-8B9A673E2028@microsoft.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
>> >
>> >
>> > "jayasunde***@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
>> > >
>> > >
>>
>>
Author
25 Sep 2006 11:29 PM
Jay
thanks people i fixed the problem. I appreciate everyone's feedback
Jay
Cor Ligthert [MVP] wrote:
Show quoteHide quote
> 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(TheDataColumnName 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" <KerryMoor***@discussions.microsoft.com> schreef in bericht
> news:AF6FD686-CB18-45C4-A7A8-8B9A673E2028@microsoft.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
> >> >
> >> >
> >> > "jayasunde***@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
> >> > >
> >> > >
> >>
> >>