magesh manavalan

magesh manavalan

  • NA
  • 331
  • 507.3k

How to bind two database table values in single GridView

Feb 23 2012 11:26 PM
How to bind two database table values in single GridView.

my design and coding is like,

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class maindatabase : System.Web.UI.Page
{
SqlConnection con1 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["school"].ConnectionString.ToString());
SqlConnection con2 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["College"].ConnectionString.ToString());
SqlConnection con3 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["University"].ConnectionString.ToString());


protected void Page_Load(object sender, EventArgs e)
{

}


protected void ImageButton1_Click1(object sender, ImageClickEventArgs e)
{


SqlDataAdapter cmd = new SqlDataAdapter("select * from University.dbo.studentdetails,school.dbo.schooldetails,College.dbo.collegedetails", con1, con2, con3);
DataSet ds = new DataSet();
cmd.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();


}
}



please send me with example.


Thanks&Regs

Manavalan



Answers (1)