473,385 Members | 2,029 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.

How do you set the current row in a dataset

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
Nov 22 '05 #1
13 2330
Make a DataView that will contain only the row you want to show and bind
your control to the DataView.

Eliyahu

"Craig" <no****@austin.rr.com> wrote in message
news:O0**************@TK2MSFTNGP10.phx.gbl...
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

Nov 22 '05 #2
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" <re*************@monarchmed.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
Make a DataView that will contain only the row you want to show and bind
your control to the DataView.

Eliyahu

"Craig" <no****@austin.rr.com> wrote in message
news:O0**************@TK2MSFTNGP10.phx.gbl...
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


Nov 22 '05 #3
Dataset1.tblMyTable.Rows[5] or Dataset1.tblMyTable[5]

Is that what you are after?

Eliyahu

"Craig" <no****@austin.rr.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
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" <re*************@monarchmed.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
Make a DataView that will contain only the row you want to show and bind
your control to the DataView.

Eliyahu

"Craig" <no****@austin.rr.com> wrote in message
news:O0**************@TK2MSFTNGP10.phx.gbl...
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



Nov 22 '05 #4
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
Nov 22 '05 #5
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" <no**********@planet.nl> wrote in message
news:OS**************@TK2MSFTNGP10.phx.gbl...
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

Nov 22 '05 #6
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
Nov 22 '05 #7
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" <no**********@planet.nl> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
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

Nov 22 '05 #8
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
Nov 22 '05 #9
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" <no**********@planet.nl> wrote in message
news:eV**************@TK2MSFTNGP09.phx.gbl...
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

Nov 22 '05 #10
Hi Craig

I translate Eliyahus answer to your question when you using C# in vb.net
the [] are ()
Dataset1.tblMyTable.Rows[Currentrow] or Dataset1.tblMyTable[Currentrow]

Or in complete dataset now VB.net
Dataset1.tables(0).Rows(Currentrow)

Cor
Nov 22 '05 #11
Doesn't that just refer to the row but does not set the pointer to a row in
the dataset?
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:ur****************@TK2MSFTNGP09.phx.gbl...
Hi Craig

I translate Eliyahus answer to your question when you using C# in vb.net
the [] are ()
Dataset1.tblMyTable.Rows[Currentrow] or Dataset1.tblMyTable[Currentrow]

Or in complete dataset now VB.net
Dataset1.tables(0).Rows(Currentrow)

Cor

Nov 22 '05 #12
Hi Craig,
Doesn't that just refer to the row but does not set the pointer to a row in

the dataset?

As far as I know there is no pointer to a row in a dataset.

In windowforms there is for this the curencymanager, however as far as I
know you cannot use the currencymanager in an webpage.

Otherwise it was in VB something as

Directcast(Bindingcontext(dataset),currencymanager ).position = curindex

Cor
Nov 22 '05 #13
That's right. But you don't have to bind to the dataset. You can bind to any
property. So, all you have to do is just to wrap
Dataset1.tables(0).Rows(Currentrow) into a property and use the property
name in the data-binding expression of your textbox.

Eliyahu

"Craig" <no****@austin.rr.com> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl...
Doesn't that just refer to the row but does not set the pointer to a row in the dataset?
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:ur****************@TK2MSFTNGP09.phx.gbl...
Hi Craig

I translate Eliyahus answer to your question when you using C# in vb.net the [] are ()
Dataset1.tblMyTable.Rows[Currentrow] or Dataset1.tblMyTable[Currentrow]

Or in complete dataset now VB.net
Dataset1.tables(0).Rows(Currentrow)

Cor


Nov 22 '05 #14

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

Similar topics

13
by: Craig | last post by:
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...
3
by: Christopher Weaver | last post by:
I want to set a value in a specific field in the current row of a DataSet. This seems like the most basic thing to do but I can't find the syntax for identifying the current row. IOW, I can do...
13
by: Craig | last post by:
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...
0
by: Ben | last post by:
module main ... application.run(new splashform) .. end module after a few screen, I try to load a new codes I got from MSDN on datagrid that works on its own. I took out submain and ran...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.