473,396 Members | 1,970 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,396 software developers and data experts.

Next/Previous Record

Hello again, and happy monday!

Well I'm getting better with this and learning a lot. I've come to another road block. I'm trying to figure out a way to "scroll" through records in my Access table, one by one. It's a little different than recordsets, it seems.

Here's the code I used to guess how it might work... and it doesn't lol.

I'm guessing I'm not loading the datatable correctly, but any help would be appreciated as always :)

Jesse

Expand|Select|Wrap|Line Numbers
  1. Protected Sub NextBN_Click(ByVal sender As Object, ByVal e As EventArgs) Handles NextBN.Click
  2.         Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\WebRMS_Mobile\WebRMS.mdb")
  3.         Dim dbcomm As New OleDbCommand("SELECT PageURL FROM ArmyRootURLPages", cn)
  4.         Dim dr As OleDbDataReader
  5.         Try
  6.             cn.Open()
  7.             dr = dbcomm.ExecuteReader
  8.             Dim dt As New DataTable("ArmyRootURLPages")
  9.             dt.Load(dr)
  10.             If dr.HasRows() Then
  11.                 While (dr.Read)
  12.                     PageURL.Text = dr("PageURL")
  13.                 End While
  14.             End If
  15.         Catch ex As Exception
  16.             MsgBox(ex.Message)
  17.         Finally
  18.             cn.Close()
  19.         End Try
  20.  
  21.  
  22.     End Sub
Jul 27 '09 #1
8 2952
Frinavale
9,735 Expert Mod 8TB
I'm really not sure what you're trying to do??

You have an Access Database and you want to display records to the end user.
I see that you're filling a table (manually) with each record from the Access Database but don't see any indication of what control you're using to display the records.

What are you trying to do?
What controls are you using?
Are you sure you want to "scroll" through the records? Do you maybe want to "page" through them (with next/previous buttons)?



-Frinny
Jul 27 '09 #2
ThatThatGuy
449 Expert 256MB
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\WebRMS_Mobile\WebRMS.mdb");

The reference to the MDB file is incorrect...when you're developing any web application...the path to it's resources should reside inside the project directory....
In this case.... you could have used something like this....
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=Server.MapPath("App_Data\\WebRMS.mdb");

Usually the database files are inside App_Data folder which is inbuilt in Asp.net
Web Applications can't access resources on the system....
Server.MapPath()
will Attach the preceeding url of your website...or whatever..
Correct this one first youll get the result....ask in me for more scroll queries...
Jul 30 '09 #3
ThatThatGuy
449 Expert 256MB
One more advice don't put &nbsp 's for spaces just put up space....your code was too unreadable....
Jul 30 '09 #4
Frinavale
9,735 Expert Mod 8TB
??
  is HTML for space.....

Where did you see this?
Jul 30 '09 #5
lol, I was wondering that too.

Anyways, problem resolved.
Jul 30 '09 #6
Frinavale
9,735 Expert Mod 8TB
Glad you fixed it :)
Jul 30 '09 #7
ThatThatGuy
449 Expert 256MB
Actually frinavale when i was viewing the code part of the post it was showing  's between Dim and the variable names.....Might be some browser problem......think so....Any ways did the solution proved to be useful enough
Jul 31 '09 #8
No, it had nothing to do with the paths.

Just had to read up on datareaders and datatables, and such.
Jul 31 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: george | last post by:
Can anyone help? I query a database and return a result on the column "reference". There might be 7 listings. Each row is displayed in a table, with links through to a detail page. I am working...
5
by: Rick | last post by:
I am moving throught a set of records, my next works great but previous move to the first record. Also what is the best way to check and see if it is the first or last record in the set. ...
5
by: Bob Bedford | last post by:
Does exist a next prev function in PHP/Mysql. I've a website with returns lot of records (say about 200). The user may browse trough the list or returned records, but he has to click the record...
2
by: eeh | last post by:
Hi, Suppose I have a table "product" with fields id,name,price. I want to get a resultset of previous and current and next record when the resultset is sorted by id and id=10. The table data is...
1
by: ubmc | last post by:
Revised form layout by dragging/dropping fields from field list and deleting unwanted fields. However, unable to go to next existing record or return to previous existing record, but can add new...
9
by: Karl Roes | last post by:
Hi All, I would like some advice on Next / Previous record buttons. I have a main form for the client, and a continuous subform listing client transactions. If I open one of these transactions...
15
by: Susan Bricker | last post by:
Greetings. I have a Mainform with a subform. The Mainform has single record format and subform has continuous form format. When the Mainform opens, I force allowadditions and allowedits to FALSE...
1
by: David | last post by:
What I envision is this. The user gets a set of records in a data grid Then the user gets to select one of the rows to view the detail information about the record. Then instead of backing...
1
by: cbanks | last post by:
Hello Ladies/Gents, im in need of some serious help here.. I have a tool that allows users to view information on a form and make changes to recordsets. This tool has buttons that allow a user to...
13
by: sweetline priya | last post by:
in my project, a table called 'hardware' contains merely 5000 records..its a mysql database.. the user can add, modify or can view this hardware details one by one.. while clicking 'view' button, the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.