Excuse my English..
At work we have porting some app to MySQL, but there are still some Database in Access 2.0, Access 97, DBF, etc
Some important database is "codifica" is in access 2.0, this DB contain to many tables that are used in other DB.
I need copy data from Access to MYSQL
I Have the same schema in MYSQL as in Access for the tables I need to import.
I use the following code to import data from access to mysql in a simply way.
c# Code:
public void Importar()
{
foreach (string tabla in tablas)
{
DataTable codificaDataTable, mySqlDataTable;
creoTablas();
caminoCodifica = GetCaminoCodifica();
codificaCnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + caminoCodifica;
SqlStr = "SELECT * FROM " + tabla;
codificaAdapter = new OleDbDataAdapter(SqlStr, codificaCnn.ConnectionString);
codificaAdapter.AcceptChangesDuringFill = false;
codificaCnn.Open();
codificaDataTable = new DataTable();
codificaAdapter.Fill(codificaDataTable);
codificaAdapter.Dispose();
if (codificaDataTable != null)
{
tabla1 = tabla + "1";
SqlStr1 = "SELECT * FROM " + tabla1;
mySqladapter = new MySqlDataAdapter(SqlStr1, mySqlcnn);
mySqlCmdBuilder = new MySqlCommandBuilder(mySqladapter);
mySqladapter.InsertCommand = mySqlCmdBuilder.GetInsertCommand();
mySqladapter.Update(codificaDataTable);
mySqladapter.Dispose();
mySqlCmdBuilder.Dispose();
codificaDataTable.Dispose();
}
}
}
But I need to copy not all data, but just data (Rows) present in Access that are not present in MySQL.
Any Suggestion????