sujit bista

sujit bista

  • NA
  • 3
  • 1.6k

inserting data using dataadapter

Jan 8 2013 2:04 AM
why is this code not working 

String sql = "server=Mylappy-pc;UID=sa;PWD=helloworld;database=MySqlDbType";
            SqlConnection cn = new SqlConnection(sql);
            DataSet ds = new DataSet("Table1");
            SqlDataAdapter da = new SqlDataAdapter("Select * from Region", cn);
            da.Fill(ds, "Table1");
            DataRow dr = dsTab.Tables["Table1"].NewRow();
            dr["RegionId"] =11 ;
            dr["RegionDescription"] ="Hello";    
            ds.Tables["Table1"].Rows.Add(dr);
            SqlCommandBuilder projectBuilder = new SqlCommandBuilder(da);
            DataSet newSet = ds.GetChanges(DataRowState.Added);
            da.Update(newSet, "Table1");



Answers (1)