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
Sign In
Register
AdSense Revenue
Active Members
Today
Abhi
(65)
Appukuttan
(40)
raj krishna
(37)
Last 7 Days
Appukuttan
(660)
Babu Akkandi
(465)
Tejinder Singh ...
(273)
more...
New Feature:
Community Sites
:
Create your own .NET community website and start earning from Google AdSense !
It's Free !
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
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
!
Related Resources
How to Get newly added row in dataset
Dynamically placing comma , In between a string
Fill a DropDownList with files in a directory using c#
To fetch rows from datatable more faster
Dynamically Bind C# ASP.NET GridView
dotNet Slackers
BizTalk Adaptors
Web Design
Contact Us
Privacy Policy
Terms Of Use