views:

175

answers:

2

I have used the Borland IDE to connect to Access Databases for a while now but Borland got bought and the upgrade is more than I can afford so I am trying to switch to Visual C++ Express. I can get the explore data to show my databases how do I get from there to being able to read the records and work with them?

Which controls do I need and what do the properties need to be set too? The rest I can do.

Any assistance would be appreciated.

TIA [email protected]

A: 

Database Access with Visual C++

jitter
A: 

Take a look at this set of ADO classes, full source with samples at codeproject http://www.codeproject.com/KB/database/caaadoclass1.aspx

Opening Access database (quoted from article):

//Sample with Connection String for Access database


CADODatabase* pAdoDb = new CADODatabase();
CString strConnection = _T("");

strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;"
              "Data Source=C:\\VCProjects\\ADO\\Test\\dbTest.mdb");
pAdoDb->SetConnectionString(strConnection);

if(pAdoDb->Open())
{
  DoSomething();
  .
  .
  .
  pAdoDb->Close();
}

delete pAdoDb;
Gordon Freeman