Two steps of SQL server data replication to access

Time:2020-11-21

What we are going to tell you today is the actual operation steps of copying SQL server data into access database. The main structure of tables in copying some data in SQL Server database to access database is the same. Do not use openrowset, because access file and SQL server are not on the same machine.

The initial idea is to use two recordsets, one is to get data from SQL, the other is to insert data into access

Because there are many fields in the table, we have to use a loop


while (!m_pRecordset_sql->adoEOF)  
{  
m_pRecordset_access->AddNew();  
for (int i = 0; i < m_pRecordset_sql->Fields->Count; i++)  
{  
vValue = m_pRecordset_sql->GetCollect(_variant_t((long)i));  
m_pRecordset_access->PutCollect(_variant_t((long)i), vValue);  
}  
m_pRecordset_access->Update();  
m_pRecordset_sql->MoveNext();  
} 

The above related content is the introduction of SQL server data copy to access. I hope you can gain something.

The above related content is the description of SQL server data copied to access. I hope it will bring you some help in this respect.