473,785 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select next record from mysql db

137 New Member
Hello,
I am creating a program to save repair reports from audio/video equipment.
But i created also a searchbox wich displays 1 or more records.
But how can i get the next record when i press on a button 'next' or 'previous'?

This is some of my code:
Expand|Select|Wrap|Line Numbers
  1. conn = New MySqlConnection
  2.             Dim Command As New MySqlCommand
  3.             Dim Data As MySqlDataReader
  4.             Dim myAdapter As New MySql.Data.MySqlClient.MySqlDataAdapter
  5.             Dim Sql As String
  6.             Dim Rows As Integer = 0
  7.  
  8. conn.ConnectionString = "server=" & My.Settings.Server & ";" & "user id=" & My.Settings.Loginnaam & ";" _
  9.                                        & "password=" & My.Settings.Passwoord & ";" & "database=" & My.Settings.Database
  10.  
  11.                 Sql = "SELECT * FROM device, customer WHERE (Device.customerID = customer.ID) AND " & Search & " LIKE '%" & SearchText & "%'  ORDER BY device.ID;"
  12.  
  13.                 conn.Open()
  14.                 Command.Connection = conn
  15.                 Command.CommandText = Sql
  16.  
  17.                 Data = Command.ExecuteReader
  18.                 If Data.HasRows = False Then
  19.                     MessageBox.Show("No records found", "Albersoft - RepairService", MessageBoxButtons.OK, MessageBoxIcon.Information)
  20.                     Info_Load(sender, e)
  21.                 Else
  22.                     While Data.Read()
  23. 'doing thing..
  24. End While
  25.  

Somebody some advice?

I mean it's a kind of pagination thing.

Gr Paul
Feb 19 '08 #1
2 1412
Plater
7,872 Recognized Expert Expert
The lines
While Data.Read()
'doing thing..
Each call to .Read() moves to the next record.
I would recomend creating a DataTable (Look up MySqlDataAdapte r's for an easy way to do that) and using the datatable for things.
At very least it will give you an indexable set of records so you can move forward and back.
Feb 19 '08 #2
djpaul
137 New Member
Ohkay,
So i don't have to use the function LIMIT 0, 2(of course with some variables) and so on.
I will found it out!

Thanks!
Paul
Feb 20 '08 #3

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

Similar topics

9
5983
by: atse | last post by:
Hi, My table in the database may contain duplicate records, which means except the primary key (auto_increment) field is unique, all or almost of all the fields are with the same content. How can I select them to display and delete them? Thanks for any idea. Atse
0
1601
by: Richard Bolen | last post by:
I'm trying to write a select query that involves 2 tables. One table (Submissions) has a one to many relationship with the other table (Jobs). I'm trying to find all the records in Jobs that do NOT have a corresponding record in Submissions with a status of 1. The problem I'm having is that when there is more than one record in Submissions that match a record in Jobs and one Submissions record has a status of 1 and one record doesn't,...
4
1371
by: Denis St-Michel | last post by:
Hello All, Hope some Guru will be able to help me with this. Let's take this example table A ------------------------------------------------------------------------------- id | TicketNo | evaluation | Username ------------------------------------------------------------------------------- 1 1 9 Jamie 2 1 8.5 ...
5
3845
by: jayson_13 | last post by:
Hi, I need to implement a counter and i face problem of locking so hope that u guys can help me. I try to do test like this : 1st connection SELECT * FROM nextkey WHERE tblname = 'PLCN' FOR Update; (when i execute this statement and i guess that this will lock the
11
4441
by: pmarisole | last post by:
I am trying to use the vbscript "split" function on a multi-select field. I am trying to do a mass update of several records at a time. I am getting an error and I'm not sure what to do. Here is the code if someone could help... strID = split(request.form("proj"), ", ") projstat = split(request.form("rojstat"),",") impr = split(request.form("impr"),",") idate =...
11
12622
by: pmarisole | last post by:
I am using the following code to split/join values in a multi-select field. It is combining all the values in All the records into one long string in each record in recordset. Example: I have a recordset with 2 records. The 1st contains the split/joined values: Alan Smir, Jeff Karl The 2nd contains the value: Keith Robb When it updates database, it will put Alan Smir, Jeff Karl, Keith Robb into each record in the recordset
1
5840
by: bpforte | last post by:
Hello, I need help with building query, basically I need to select all records from one table that don't exists in second table with status 1, but they can exists in second table with status 0, to be more complicated there can be in the same record in second table with status 0 and 1 (second table is something like log) in oracle I can do: select record from table_1 where record is not in (select record from table_2 where status=1)
1
1355
by: write2ashokkumar | last post by:
hi.... i am using mysql 5.0.22 version. i have the table xxx with 2 lakhs record. if i select all the records...it takes the long time to give the result set. is there any way to fine tune the query..? i want to get the part of record set at the time of query execution. For example i expect 2 lakhs records in my select query.... but it takes long time to give the result set... to avoid this. i need the part of records from...
1
4030
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which are not bound, I select from the bottom set and add to the top set which works fine, but now i decide to remove an item from the top set. when i tried to use a remove item code it worked fine, it did delete the item form the list but it added...
0
10325
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8972
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.