AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Getting data into gridview from tables selected in dropdownlistbox
Posted by kishore on  4/22/2008 11:59:46 PM Category: ADO.NET
Add to my favorites
Email to friend
Hi all
i am using .NET 2.0 here i am getting problem in displaying the information in gridview.
actually my intention is i want to fill the data set with different tables from a database using different adapters. the tablenames filled in dataset has to be added into dropdownlist items.
when ever a tablename selected from dropdownlist the correspondin information should display in gridview.if there is any modifications the table has to update the changes made by user n need to bind gridview. please anyone could help me .plzzz its urgent

Regards
kishore

Post Your Reply Post New Question

 Viewer's Reply
this is raju from hyd
Answered By boda.raju on 5/13/2008 2:07:33 PM
Description:
hi , first ur selected tables in dropdownlist dynamically(ie, through properties) then write
code under dropdownlist

string tab = DropDownList1.SelectedItem .ToString();
SqlConnection cn = new SqlConnection("Data Source=AMSOL-601;Initial Catalog=bn.raju;User ID=sa");
SqlDataAdapter da = new SqlDataAdapter("select *from " + tab + "", cn);
DataSet ds = new DataSet();
da.Fill(ds, "exa");
GridView1.DataSource = ds;
GridView1.DataBind();
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Simply JavaScript - Free 150 Page Preview!
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
When Good HTML Goes Bad: How You Can Protect Your Web Applications