Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all ... sorry for my english, im italian.
i have X records and i dont use datagrid.
I just want to put 12 records per page.
the records can be hundreds and each record
has a picture, a name, and a city.
how do i display only 12 records per page
and continue with a "forward button" for the next
records until the end of the records?
thanks to all, Nick.
Posted
Comments
Prasad Khandekar 9-Mar-13 13:48pm    
Which database are u using. For MySQL it's relatively very easy. With MySQL you can use LIMIT offset, page_size clause. The pagination will be done by DB itself.

MSSQL Server 2012 also supports this as well as PostgresSQL. Have a look at MSDN Documentation located here. (http://msdn.microsoft.com/en-en/library/ms188385.aspx#Offset)
regards,

1 solution

You need to print 12 records directly and then send the following escape sequence to the printer:

"\f"

This will make sure that next printout will be on the next page.

See also:
http://msdn.microsoft.com/en-us/library/h21280bw(v=vs.80).aspx[^]

and this article:
http://www.textcontrol.com/en_US/blog/archive/20060901/[^]
 
Share this answer
 
Comments
Nick1961 9-Mar-13 14:37pm    
Sorry i mean display 12 records to screen not print.
here my part of code :

SqlCommand Conta = new SqlCommand("Select COUNT (*) FROM UtentiRegistrati", ConnUtentiRegistrati);
int NumRec = int.Parse(Conta.ExecuteScalar().ToString());
SqlCommand RecuperaDati = new SqlCommand("Select * FROM UtentiRegistrati", ConnUtentiRegistrati);
SqlDataReader Legge = RecuperaDati.ExecuteReader();

while (Legge.Read())
{
label1.Text = Legge.GetValue(1).ToString();
label2.Text = Legge.GetValue(2).ToString();
label3.Text = Legge.GetValue(3).ToString();
Utente_1.ImageLocation = label3.Text.ToString();
Utente_1.SizeMode = PictureBoxSizeMode.Zoom;
}

This code passes all the records unfortunately

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900