The code is:
string conn_str="Provider=MSDAORA.1;User ID=navuser2;Data Source=orcl;Password=navuser2";
OleDbConnection conn=new OleDbConnection(conn_str);
conn.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = "select * from TEST";
cmd.Connection = conn;
OleDbDataAdapter adap=new OleDbDataAdapter(cmd);
DataSet dtset=new DataSet();
adap.Fill(dtset,"test");
DataTable tab1;
tab1=dtset.Tables["test"];
int a=600;
string b="axxxxx";
string ins="Insert into test values (" + a + ",'" + b + "'" + ")";
DataRow r1;
r1=tab1.NewRow();
r1[0]=a;
r1[1]=b;
tab1.Rows.Add(r1);
adap.InsertCommand=new OleDbCommand(ins,conn);
adap.Update( dtset, "test");
conn.Close();
//---end of code----------
In the above code, don’t u think there is redundancy of code. 1st we are writing SQL to insert data, then we are exclusively specifying individual fields of rows(e.g. r1[0]=a ). Is there anyway to avoid this?
My question is why we are doing the same thing in 2 ways? suppose there are 15 fields. in that case, along with query, we will have to mention 15 fields also.
How to avoid this?

Answers
Know the answer? Post it. Somebody with the same question will find it here.