dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersRaj.Trivedi
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » .NET »

Binding two table values in one datagridview in vb.net'


Posted Date: 12 Jul 2012      Posted By:: Siva Shankar     Member Level: Silver    Member Rank: 1483     Points: 1   Responses: 1



I am having two tables in my database.I am taking some field in two table and i want to bind the two table values in one datagridview in vb.net.



Responses

#679977    Author: Anil Kumar Pandey      Member Level: Platinum      Member Rank: 1     Date: 12/Jul/2012   Rating: 2 out of 52 out of 5     Points: 3

You can either merge the value in one single table or select the value from both the table to read and bind it.


SqlConnection con = new SqlConnection(ConnStr);
string strQuery = "select a.Name,b.Address from emp a,Details b
where a.Id>100";

SqlDataAdapter ada = new SqlDataAdapter(strQuery, con);
DataSet lds = new DataSet();
ada.Fill(lds);
gvSales.DataSource = lds;
gvSales.DataBind();


Thanks & Regards
Anil Kumar Pandey
Microsoft MVP, DNS MVM



 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Split the notepad based on line count in c#
Previous : Read&Write Large Text File Simultaneously.
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.