?
Solved

Moving through a Dataset using VB.NET in a Webform

Posted on 2005-03-04
5
Medium Priority
?
238 Views
Last Modified: 2007-09-24
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
       
        cn.Open()

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


I would greatly appreciate some expert help!

Thanks
0
Comment
Question by:Mike_Stevens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:CaptainRantflaps
ID: 13459914
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.
0
 

Author Comment

by:Mike_Stevens
ID: 13459960
I am using textbox controls.
0
 
LVL 5

Expert Comment

by:CaptainRantflaps
ID: 13460076
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?
0
 

Author Comment

by:Mike_Stevens
ID: 13460319
Yes.  That is what i am trying to do.
0
 
LVL 6

Accepted Solution

by:
jyotisinha earned 750 total points
ID: 13460554
Mike,

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];
textbox1.text=dr["columnName1"];

hope this helps.
Jyoti.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question