I have taken two con. object for connecting with sdf database and mdf.
and also i have taken dataset ds1 , which will hold value from sdf database.
here I have read data from ds1 and then insert into MDF database
try this code-
string stConnection1 = "constring1"; //for sdf
string stConnection2 = "constring2"; //for mdf
SqlConnection cn1 = new SqlConnection(stConnection1 );
SqlCommand cmd1= new SqlCommand("select * from employees",cn1);
SqlCeDataAdapter da1= new SqlCeDataAdapter (cmd1);
SqlCommandBuilder cb = new SqlCommandBuilder(da1);
SqlConnection cn2 = new SqlConnection(stConnection2 );
SqlCommand cmd2= new SqlCommand();
cmd2.Connection=cn2;
DataSet ds1= new DataSet();
da1.Fill(ds1,"Employees");
int limit = ds1.Tables["Employees"].Rows.Count;
for (int i = 0; i < limit; i++){
//NOW INSERT DATA INTO MDF DATABASE
string strInsert= "Insert into tablename(col1,col2) values('" + ds1.Tables["Employees"].Rows[i][0].ToString() + "','" + ds2.Tables["Employees"].Rows[i][1].ToString() + "' )"
cmd2.Commandtext=strInsert;
cmd2.ExecuteNonQuery();
}
try this code and let me know.