C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






How to get record from 5 to 15 from a dataset


Posted Date: 16 May 2008    Resource Type: Code Snippets    Category: ADO.NET
Author: Shivshanker CheralMember Level: Diamond    
Rating: Points: 10



The following code shows how to get record from 5 to 15 from a dataset

 
SqlConnection con1=new SqlConnection (ConfigurationSettings.AppSettings["cons"]);SqlCommand cmd=new SqlCommand("GetRec",con1);
SqlDataAdapter db=new SqlDataAdapter();
db.SelectCommand=cmd;

cmd.CommandType=CommandType.StoredProcedure;

DataSet ds = new DataSet();
db.Fill(ds,5,15,"student");

DataGrid1.DataSource=ds;
DataGrid1.DataBind();


this will return the 15 rows of the resultset.
In the above code " GetRec" is the name of the storedprocedure.




Responses

Author: Siva Prasad    21 May 2008Member Level: Gold   Points : 2
Hello my friend,

1 ) SqlConnection sqlConnection = new SqlConnection ( connectionString );

2 ) SqlDataAdapter sqlDataAdapter = new SqlDataAdapter ( "Select * From TableName", sqlConnection );

3 ) DataSet dataSet = new DataSet ();

4 )sqlDataAdapter.Fill ( dataSet, 4, 10, "TableName" );

5 ) GridView1.DataSource = dataSet;

6 ) GridView1.DataBind ();

Siva Prasad Palaparthi
Software Engineer.

palaparthi_sivaprasad@yahoo.com


Author: Bharathi    22 May 2008Member Level: Diamond   Points : 2
Really an easy method for getting the range of rows within the datatable.


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Dataset  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Extracting Datatable From SqlDataSorce
Previous Resource: How to fetch data from SqlServer database to XML format using SQLXML
Return to Discussion Resource Index
Post New Resource
Category: ADO.NET


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use