Prior to the upgrade I simply used a MySqlDataAdaptor (with a DataSet) to handle all DB operations (insert, updates, etc) and everything worked with no problems. Since the upgrade I have had need to use transactions in my application (user discarding new edits, etc). The code I had to write changes back to the DB has not changed.
The problem. DB inserts, updates and deletes are no longer working since I started using the transaction. These are valid DB table changes which all worked previously and no code has changed to do with saving changes back to the DB.
My question is. Do I need to revise my commit method to take into account the changes to use transactions ? If I do, will the adaptor be aware of the transaction ? In essence, what code needs to be looked at and revised ?
Many thanks in advance for any info/suggestions.
Here's the code I use to save changes back to the DB.
Code: Select all
cMySqlDataAdapter.Update(m_cDataSet);
Code: Select all
try
{
m_cDataSet = new DataSet();
cMySqlDataAdapter.FillSchema(m_cDataSet, SchemaType.Mapped, "ResultsTable");
cMySqlDataAdapter.Fill(m_cDataSet);
}
catch (MySqlException e)
{
// throw a new select exception
string strError;
strError = "Select command failed. SQL is: \n";
strError += cMySqlDataAdapter.SelectCommand.CommandText;
strError += "\nError is: \n";
strError += e.Message;
throw new DAOSelectException(strError);
}
Code: Select all
try
{
cMySqlConnection.Open();
cMySqlConnection.BeginTransaction();
m_bIsConnectionOpen = true;
}
catch (MySqlException ex)
{
throw new DAOConnectException("Failed to connect to the database. Reason: " + ex.Message);
}