C# Tutorials and offshore development in India
    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



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

How can we load multiple tables in to Dataset?


Posted Date: 10 Jan 2009      Posted By: sahasra      Member Level: Silver     Points: 1   Responses: 2



How can we load multiple tables in to Dataset?




Responses

Author: Syed Shakeer Hussain     10 Jan 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 5

Hi..

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["connection"].ToString());
connection.Open();
string Table1cmd = "select * from Table1";

SqlDataAdapter adapter1 = new SqlDataAdapter(Table1cmd, connection);
SqlCommandBuilder builder1 = new SqlCommandBuilder(adapter1 );
DataSet dataset1 = new DataSet();
adapter1.Fill(dataset1, "Table1cmd");

//For Table2

string Table2cmd = "select * from Table2";

SqlDataAdapter adapter2 = new SqlDataAdapter(Table2cmd, connection);
SqlCommandBuilder builder2 = new SqlCommandBuilder(adapter2
DataSet dataset2 = new DataSet();
adapter2.Fill(dataset2, "Table2");
}


Thanks & Regards!
Syed Shakeer Hussain



Author: Chan Lemo    13 Jan 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 1

check the following url

http://vb.net-informations.com/dataset/dataset-multiple-tables-sqlserver.htm

chan.



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 : How to design a row of tabs,Such they can scroll horizontaly when mouse goes to last one.
Previous : I have prob with change day part of datetime in C#
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use