private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=.;AttachDbFilename=C:\Users\Amit\Documents\ghf.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"); SqlDataAdapter sda = new SqlDataAdapter(("create table #xyz(pid int, pname nvarchar(50),pamount nvarchar(50),cid int,cname nvarchar(50)"), con); dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt; } SqlConnection con = new SqlConnection(@"Data Source=.;AttachDbFilename=C:\Users\Amit\Documents\ghf.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"); SqlCommand cmd = new SqlCommand("insert into #xyz (pid, pname, pcost , cid ,cname) select product.pid,product.pname,product.pcost ,category.cid ,category.cname from product inner join category on product.cid = category.cid", con); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)