Click here to Skip to main content
12,625,912 members (26,690 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Data » Downloads

Stats

29K views
552 downloads
29 bookmarked
Posted

Generic Paging for Recordset with Next Back Navigation

, 20 Jun 2005 CPOL
This article is basically about a Paging control required for project purposes. One can use this just by changing three parameters.
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;

namespace Paging
{
	/// <summary>
	/// Summary description for ReadData.
	/// </summary>
	public class ReadData
	{
		private string strSelectQuery;
		private string strConn;
		public ReadData()
		{
			//
			// TODO: Add constructor logic here
			//
			strSelectQuery=null;
			strConn=null;
		}
		public ReadData(string _strQuery,string _conn)
		{
			strSelectQuery=_strQuery;
			strConn=_conn;
		}
		public DataTable LoadRecordIntoTable()
		{
			SqlConnection objConn=new SqlConnection(strConn);
			DataTable tblOfRec =new DataTable();

			try
			{
				objConn.Open();
				//Using helps to dispose object as soon as 
				//required process gets complete
				using(SqlDataAdapter objAdpOnCat=new SqlDataAdapter(strSelectQuery,objConn))
				{

					objAdpOnCat.Fill(tblOfRec);
					
				}

			
			}
			catch(SqlException e)
			{
				throw new Exception("Invalid Connection Error Occured  "+e.Message);

			}
			finally
			{
				if(objConn.State.ToString()=="Open")
				{
					objConn.Dispose();
					objConn.Close();
					
				}
			}
			return tblOfRec;
		
		
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

About the Author

santosh poojari
Technical Lead
India India
Whatsup-->Exploring--> MVC/HTML5/Javascript & Virtualization.......!
www.santoshpoojari.blogspot.com

You may also be interested in...

Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161205.3 | Last Updated 21 Jun 2005
Article Copyright 2005 by santosh poojari
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid