PC Review


Reply
Thread Tools Rate Thread

How do you set the current row in a dataset

 
 
Craig
Guest
Posts: n/a
 
      11th May 2004
How do you set the current row of a dataset?
I want to bind a control to a field from the 5th row in a dataset.
I fill the dataset, then I want to set the row to the 5th row and then do
the databinding.

Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?



'Sets the value for a field using index number......
Dataset1.tblMyTable(1).FieldName = strName

'Iterates through rows of a dataset but does not set the row
explicitly......
For Each myRow In DataSet1.tblMyTable.Rows
strName = myRow("FieldName")
Next


 
Reply With Quote
 
 
 
 
Craig
Guest
Posts: n/a
 
      11th May 2004
I understand how to do that but it does not do what I need.

The row I want to show is based on the "index" or row number. I may want to
show row 5 then row 100 then row 48. So I need to be able to set the current
row to 5.

How do I do that?
Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?



"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Make a DataView that will contain only the row you want to show and bind
> your control to the DataView.
>
> Eliyahu
>
> "Craig" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > How do you set the current row of a dataset?
> > I want to bind a control to a field from the 5th row in a dataset.
> > I fill the dataset, then I want to set the row to the 5th row and then

do
> > the databinding.
> >
> > Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?
> >
> >
> >
> > 'Sets the value for a field using index number......
> > Dataset1.tblMyTable(1).FieldName = strName
> >
> > 'Iterates through rows of a dataset but does not set the row
> > explicitly......
> > For Each myRow In DataSet1.tblMyTable.Rows
> > strName = myRow("FieldName")
> > Next
> >
> >

>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      11th May 2004
Make a DataView that will contain only the row you want to show and bind
your control to the DataView.

Eliyahu

"Craig" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How do you set the current row of a dataset?
> I want to bind a control to a field from the 5th row in a dataset.
> I fill the dataset, then I want to set the row to the 5th row and then do
> the databinding.
>
> Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?
>
>
>
> 'Sets the value for a field using index number......
> Dataset1.tblMyTable(1).FieldName = strName
>
> 'Iterates through rows of a dataset but does not set the row
> explicitly......
> For Each myRow In DataSet1.tblMyTable.Rows
> strName = myRow("FieldName")
> Next
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      11th May 2004
Hi Craig,

How do you do that databinding for that 5th row, you makes me curious,

I assume it is aspnet, because if it is windowsform it is easy to tell
however that does not work on a webform.

Cor


 
Reply With Quote
 
Craig
Guest
Posts: n/a
 
      11th May 2004
I am using webforms.

I want to do a 'next page' or 'previous page' function using a web form I
was going to use the row number of the dataset and increment each time or
decrement it each time and rebind the form.

How would I do the 'next page' or 'previous page' functionality using a web
form?

I know I can refer to any row in a dataset but it seems ridiculous that I
can't set the row of a dataset.

Why doesn't the tool box have a next record navigation functionality built
in, Interdev did?


"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:OSo$(E-Mail Removed)...
> Hi Craig,
>
> How do you do that databinding for that 5th row, you makes me curious,
>
> I assume it is aspnet, because if it is windowsform it is easy to tell
> however that does not work on a webform.
>
> Cor
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      11th May 2004
Are you using a datagrid?

The index is of course the way Eliyahy showed you.

So that I do not need to answer anymore.

Cor


 
Reply With Quote
 
Craig
Guest
Posts: n/a
 
      11th May 2004
No it is using textbox controls on a single page.

I have created a datagrid and set the paging to 1. That worked. But a
complex form can be easier as a webform full of controls.

So any ideas?


Name _________
Address _________

"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Are you using a datagrid?
>
> The index is of course the way Eliyahy showed you.
>
> So that I do not need to answer anymore.
>
> Cor
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      11th May 2004
Hi Craig

In my opinion did you got the idea for that from Eliyahu.

Know that a dataset and your currentindex does not persist when you do not
set it in a session (or a viewstate or a cache, however the last should be a
nonchanging dataset).

Cor


 
Reply With Quote
 
Craig
Guest
Posts: n/a
 
      11th May 2004
Eliyahu said....

Make a DataView that will contain only the row you want to show and bind
your control to the DataView.
and...
Dataset1.tblMyTable.Rows[5] or Dataset1.tblMyTable[5]

I don't see how that helps. I just want to bind the controls to he first
row, then the user clicks a next button and then I'll bind the controls to
the next row etc. I don't care if the dataset has to be refilled etc. and
I'll maintain the current row in a ViewState("Currentrow") variable.

So how can I set the row number in the dataset?

Maybe I'll just stick to a datagrid with paging set to 1.



"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Craig
>
> In my opinion did you got the idea for that from Eliyahu.
>
> Know that a dataset and your currentindex does not persist when you do not
> set it in a session (or a viewstate or a cache, however the last should be

a
> nonchanging dataset).
>
> Cor
>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      11th May 2004
Dataset1.tblMyTable.Rows[5] or Dataset1.tblMyTable[5]

Is that what you are after?

Eliyahu

"Craig" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I understand how to do that but it does not do what I need.
>
> The row I want to show is based on the "index" or row number. I may want

to
> show row 5 then row 100 then row 48. So I need to be able to set the

current
> row to 5.
>
> How do I do that?
> Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?
>
>
>
> "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Make a DataView that will contain only the row you want to show and bind
> > your control to the DataView.
> >
> > Eliyahu
> >
> > "Craig" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > How do you set the current row of a dataset?
> > > I want to bind a control to a field from the 5th row in a dataset.
> > > I fill the dataset, then I want to set the row to the 5th row and then

> do
> > > the databinding.
> > >
> > > Dataset1.tblMyTable.CurrentIndex = 5 or something like that maybe?
> > >
> > >
> > >
> > > 'Sets the value for a field using index number......
> > > Dataset1.tblMyTable(1).FieldName = strName
> > >
> > > 'Iterates through rows of a dataset but does not set the row
> > > explicitly......
> > > For Each myRow In DataSet1.tblMyTable.Rows
> > > strName = myRow("FieldName")
> > > Next
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Current Dataset or View (PLEASE HELP) Mike Microsoft Access 0 15th Dec 2005 04:16 PM
Current Dataset or View (PLEASE HELP) Mike Microsoft Access Forms 0 15th Dec 2005 04:16 PM
Re: does DataSet.ReadXml() clear current table information on DataSet CrunkByte Microsoft Dot NET Framework 0 21st May 2005 03:11 AM
How do you set the current row in a dataset Craig Microsoft ASP .NET 13 11th May 2004 05:52 PM
Dataset Current row Joel Microsoft VB .NET 4 20th Nov 2003 08:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:59 PM.