• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Moving through a Dataset using VB.NET in a Webform

I am working on a simple web application that will allow users to add, update or delete information about customers.   I would normally use VB6 and ado to do this becuase it would allow me to move around a recordset using buttons for previous, next, add new, delete and save to handle all of the basic editing functions.

Because this new project that i am working on needs to be web based i am using visual studio.net.   I am looking for any input or examples of code that i can use to move through a dataset in the same manner that i am familiar with in VB6/ADO.

I am using the following to connected to my database (Access Database) and to fill the dataset.  

 Dim strSQL As String
        Dim strConn As String

        strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application("Data_Path") & ";Jet OLEDB:Database Password=exhibit_info@05"
        strSQL = "SELECT * FROM tblExhibitor_Info ORDER BY tblExhibitor_Info.Last_Name, tblExhibitor_Info.First_Name;"

        Dim cn As New OleDb.OleDbConnection(strConn)
        Dim da As New OleDb.OleDbDataAdapter(strSQL, strConn)
        Dim ds As New DataSet

        If Not IsPostBack Then
            da.Fill(ds, "exhibitor_info")
        End If

I would greatly appreciate some expert help!

  • 2
  • 2
1 Solution
Are you binding this to a Datagrid control? if so, use the paging option and you will automatically get prev/next or numbering for each separation of the data.
Mike_StevensAuthor Commented:
I am using textbox controls.
Let me see I have this right, you want to display the first value from your dataset in a text box, and have next and prev buttons, clicking next will move to the next record etc?
Mike_StevensAuthor Commented:
Yes.  That is what i am trying to do.

for this you need to keep the dataset in session and
with every prev/next click, store the record no in viewstate.
on click retreive this no (I'm putting here in a variable recNo) and use datarow as follows -

DataRow dr=dataset1.Tables["table1"].Rows[recNo];

hope this helps.

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now