Question

I want to update the table using command builder by passing table of data throw datatable so i implemented this but some errors occured please tell me how to rectify it following is my code.

  public int Updateoutlettubscans(DBS objDbo)
        {
            DataTable dt = new DataTable("emp");
            String connString = strDBConnection;

            String sqlSelect = "select * from emp; 
            DataSet ds = new DataSet();

            OracleDataAdapter da = new OracleDataAdapter(sqlSelect, connString);
            OracleCommandBuilder cb = new OracleCommandBuilder(da);
            da.Fill(ds, "emp");
            dt = objDbo.DataTableName;
            //dt=dt.copy();
            ds.Tables.Add(dt);
            da.Update(ds, "Table");
}

the error is DataTable already belongs to another DataSet. if i use dt.copy() method then no error but the table not updated with new data, how can i update my table please tell me.

Était-ce utile?

La solution

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top