2
Answers

SqlCommandBuilder

jaya krishnan

jaya krishnan

15y
3.7k
1

i am using pubs Database and Two Tables
1. A (Table name) 
   
   it contains two field  
 1 id int,
 2 name varchar(10)
2. B (Table Name)               - is is empty table
 it contains two field  
 1 name varchar(10),
This is My problem using SqlCommandBuilder
 string a = "server=.;database=pubs;uid=sa;pwd=jk;";
 string b ="select name from A where id=1;
 SqlConnection con = new SqlConnection(a);
 SqlDataAdapter da = new SqlDataAdapter(b, con);
 Dataset ds = new DataSet();
 da.Fill(ds,"Temp"); ------------------Dataset 1
 
 string c ="select * from B;
 SqlConnection con1 = new SqlConnection(a);
 SqlDataAdapter da1 = new SqlDataAdapter(c, con);
 Dataset ds1 = new DataSet();
 da1.Fill(ds1,"Vemp"); ------------------------- Dataset 2
 SqlCommandBuilder buil = new SqlCommandBuilder(da1);
 da1.Update(ds,"Temp");
  
is is possible to insert  A table to B using Command Builder
Answers (2)