Tutorials
Resources
Forum
Reviews
Communities
Interview
Jobs
Projects
Training
Your
Ad
Here
Silverlight Games
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Polls
|
Revenue Sharing
|
Lobby
|
Gift Shop
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Alwyn
(42)
Nadheera V
(40)
Abhisek Panda
(40)
Last 7 Days
Alwyn
(706)
nishithraj
(512)
Gaurav Arora
(504)
more...
Resources
»
Code Snippets
»
Databinding
»
filter table at runtime from dataset and store it in datatable in c#
Posted Date: 07 Jul 2008
Resource Type:
Code Snippets
Category:
Databinding
Author:
Sujit Kumar
Member Level:
Diamond
Rating:
Points
: 10
hi,
In this article I am filtering data from dataset and store it in different different table.
//connect to sql
con = new SqlConnection("Data Source=sujitkumar\\sqlexpress;Initial Catalog=pubs;Integrated Security=SSPI");
//in this line I have filled up dataset with two table, in first table all records are comming and in second table only unique id are coming from database.
String query = "select * from student;select distinct(id) from student";
da = new SqlDataAdapter(query, con);
da.Fill(ds);
//here I filled up different different table with unique id.
int count = ds.Tables[1].Rows.Count-1;
for (int i = 0; i <= count; i++)
{
DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter = "id=" + ds.Tables[1].Rows[i][0];
DataTable dt = new DataTable();
dt=dv.ToTable(i.ToString());
ds.Tables.Add(dt);
}
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
to add tags.
Filter data from dataset
.
Datatable
.
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:
ASP.NET DataList control with Next and Previous Buttons
Previous Resource:
Enable and Disable a Control by Binding to another Control
Return to Discussion Resource Index
Post New Resource
Category:
Databinding
Post resources and
earn money
!
More Resources
ASP.NET DataList control with Next and Previous Buttons
How to Get newly added row in dataset
How to Get Errors in dataset
Binding Data From Textbox to Dropdown
Dynamically Bind C# ASP.NET GridView
How to do Paging with Repeater control
dotNet Slackers
About Us
Contact Us
Privacy Policy
Terms Of Use