Noob Time ... Record Navigation

nkwk

Newcomer
Joined
Mar 11, 2004
Messages
13
I've written a couple of windows based database apps now which would usually use this code to navigate to the next record:

Visual Basic:
Me.BindingContext(DataSet1, "mailinglist").Position = (Me.BindingContext(DataSet1, "Mailinglist").Position + 1)

But in asp.net this isnt possible.

My feeble code currently exists of:

Visual Basic:
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SqlDataAdapter1.Fill(DataSet11)
        TextBox1.DataBind()


    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    End Sub

This has bound a textbox to the dataset.

How would i navigate to the next record in the dataset?

Nick
 
A DataSet is made of Tables (ds.Tables)
And a Table is made of Columns and Rows (.Rows .Columns)

You can index them with (x) where x is an integer or , in the case of Columns, the ColumnName.
 
Man ... i'm seriously stuck.

Could someone explain this to me.

I keep seeing references to datagrid's everywhere. But i'm not use if thats what i want.

I'm just trying to create a basic webform that will navigate records on the sql server.

So textbox1 would read record one on load. Then when you hit next Textbox1 displays record 2.

I cant find example coding anywhere for the next button :(

nick
 
Web applications behave differently from Windows applications. A windows application will maintain state as long as the application is running and as such will persist the DataSet between button clicks.
Web applications however lose their state between postbacks (button clicks etc) and will require either the DataSet to be recreated on each page refresh or for it to be deliberately stored on the server (probably as a Session, Application or Cache variable, depending on your requirements).
To allow a simple Next button to work you would need to store the current position in the DataSet so it could be accessed across postbacks (probably using Session, ViewState or QueryString). This would need to be read each time the page is refreshed and the appropriate data retrieved and used to populate the page.
 
Last edited:
I'm going to try and use a session called "index" which will store on button_click and retrieve on page load.
 
Sorry for keep coming back and forth but i don't have a clue lol. I'm figuring it out as i go along.

How do i make the dataset goto the position that i have stored?

Say I wanted it to goto record 10.

Its not dataset11.tables(0).rows(10)

(lost)

Nick
 
Back
Top