Can someone tell me why this SQL Command at the end is not working? I am a noob, but I have tried everything I can think of and I am getting nowhere. There is no literature on how to do something like this... It would have to be my first project LOL
I am trying to create an append program to merge identical Access databases populated at different client locations. I would not have used Access personally, but they didn't ask me...
OleDbConnection CNCTOld = new OleDbConnection(@"provider = microsoft.jet.oledb.4.0; data source = c:\MDR\MDR_BE\mdr_be.mdb;");
OleDbConnection CNCTNew = new OleDbConnection(@"provider = microsoft.jet.oledb.4.0;" + "data source = " + DBPath + ";");
CNCTNew.Open();
CNCTOld.Open();
string cmdStr1 = "Select * from tbl_dat_RecordsGen";
OleDbDataAdapter DA1 = new OleDbDataAdapter(cmdStr1, CNCTNew);
OleDbDataAdapter DA2 = new OleDbDataAdapter(cmdStr1, CNCTOld);
DataSet DS1 = new DataSet();
DataSet DS2 = new DataSet();
DA1.Fill(DS1, "tbl_dat_RecordsGen");
DA2.Fill(DS2, "tbl_dat_RecordsGen");
DataTable DTNew = DS1.Tables["tbl_dat_RecordsGen"];
DataTable DTOld = DS2.Tables["tbl_dat_RecordsGen"];
OleDbCommand StrSQL = CNCTOld.CreateCommand();
StrSQL.CommandText = "INSERT INTO " + DTOld + " SELECT * FROM " + DTNew + " WHERE (" + DTOld + ".AuditID <> " + DTNew + ".AuditID) OR (" + DTOld + ".ChartNo <> " + DTNew + ".ChartNo) OR (" + DTOld + ".ChartID <> " + DTNew + ".ChartID)";