This problem has been around for a long time and has not been valued since it has not greatly affected the project progress. I have encountered this problem recently, and I am determined to study it carefully. I searched the internet for half a day, but I didn't find any easy-to-understand articles. I couldn't help it. Let's take a look at Microsoft's documents and record the Solution Process for your reference. Problem description
This problem has been around for a long time and has not been valued since it has not greatly affected the project progress. I have encountered this problem recently, and I am determined to study it carefully. I searched the internet for half a day, but I didn't find any easy-to-understand articles. I couldn't help it. Let's take a look at Microsoft's documents and record the Solution Process for your reference. Problem description
This problem has been around for a long time and has not been valued since it has not greatly affected the project progress. I have encountered this problem recently, and I am determined to study it carefully. I searched the internet for half a day, but I didn't find any easy-to-understand articles. I couldn't help it. Let's take a look at Microsoft's documents and record the Solution Process for your reference.
Problem description:
ADODB: _ ConnectionPtr m_pConnection1;
ADODB: _ ConnectionPtr m_pConnection2;
ADODB: _ RecordsetPtr m_pRecordset1;
ADODB: _ RecordsetPtr m_pRecordset2;
The initialization process is omitted ......
When using
M_pRecordset1-> Open (pSql, m_pConnection1.GetInterfacePtr (), ADODB: adOpenDynamic, ADODB: adLockOptimistic, ADODB: adCmdText );
After the INSERT, UPDATE, and Delete operations, use m_pConnection2 and m_pRecordset2 to query the updated table. We found that the data just added to m_pConnection1 could not be found and the modified data was not updated, deleting records is still in the database.
This problem occurs only when two or more connections are used for database operations. Only one connection does not. But in many cases, we have to use multiple connections to operate data at the same time, so the problem must be solved.
Solution:
Use
"Transaction": Use the JRO engine to forcibly refresh the data cache of the query connection.
# Import "c: \ program files \ common files \ system \ ado \ msjro. dll "// start transaction m_pConnection-> BeginTrans (); // inster update delete operation code omitted // submit m_pConnection-> CommitTrans ();// Refresh the cache and refresh the cache before the query, so there will be no data delay. BOOL CDBOperate: RefreshData () {JRO: IJetEnginePtr jet (_ uuidof (JRO: JetEngine); jet-> RefreshCache (m_pConnection); return TRUE ;}
Use the code above to synchronize data with multiple ACCESS connections.References
Http://support.microsoft.com/kb/200300