Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is ADO (OLE DB) faster than VFP 6?
Message
 
À
Tous
Information générale
Forum:
Visual C++
Catégorie:
Source de données
Titre:
Is ADO (OLE DB) faster than VFP 6?
Divers
Thread ID:
00935342
Message ID:
00935342
Vues:
55
Hi Everybody,

I tried to find out which one was faster, ADO or Visual FoxPro 6. Therefore, I created a table with 112089 records. I ran the following command:
nStart = Seconds()
use C:\Projects\Lagger-3d\Desurvey\Desurvey
Replace all Elev With 23.99
Use In Desurvey
? Seconds() – nStart
It took 8.47 seconds in Visual FoxPro 6.

Then, I restarted the computer and run the required ADO commands to access a dbf file in VC++:
{
   char szFilters[]=
      "Drillhole data (*.dbf) | All Files (*.*)|*.*||";

   CFileDialog fileDlg (TRUE, "dbf", "*.dbf",
      OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, szFilters, this);
   if( fileDlg.DoModal ()==IDOK )
   {
      CString pathName = fileDlg.GetPathName();
      CString fileName = fileDlg.GetFileTitle ();
      _ConnectionPtr  spCON = NULL;
      try{

	 time_t ltime, ltime2;
	 time(<ime);  //start time
         ::CoInitialize(NULL);
         CREATEiNSTANCE(spCON,Connection);
         HRESULT hr = spCON->Open("Provider=vfpoledb.1;Data Source="+  (_bstr_t) pathName, "", "", adOpenUnspecified);
 	 if(!SUCCEEDED(hr))
	 {
	     MessageBox("Could not read from the file: \"" + pathName +  "\"", "Ali Marandi", MB_OK);
	     return;
	 }
	 _CommandPtr cmd = NULL;
	 _variant_t vNull(0L);
	 vNull.vt=VT_ERROR;
	 vNull.scode=DISP_E_PARAMNOTFOUND; 
	 cmd.CreateInstance(__uuidof(Command));
	 cmd->ActiveConnection=spCON;
	 cmd->CommandType=adCmdText;
	 cmd->CommandText = "UPDATE "+ (_bstr_t) fileName +" SET Elev = 23.99";
	 cmd->Execute(&vNull,&vNull,adCmdUnknown);
         IADORecordBinding *picRs = NULL;
	 spCON->Close();
	 time(<ime2);
	 char  buffer[200];
	 sprintf(buffer, "Time in seconds \t%ld\n", ltime2 - ltime );
         MessageBox(buffer);
     
      }
      catch( _com_error &e){
        _bstr_t bstrSource(e.Source());
        _bstr_t bs =  _bstr_t(" Error: ") + _bstr_t(e.Error()) + _bstr_t(" Msg: ")  + _bstr_t(e.ErrorMessage()) + _bstr_t(" Description: ") 
            + _bstr_t(e.Description());
      
	MessageBox(bs); 
      } 
   }	
}
It took 10 seconds.

I thought ActiveX Data Objects should be faster or at least the same as Visual FoxPro 6 because ActiveX Data Objects goes directly to OLE DB.

Did I do something wrong or you got the same results?

Thank you,
Ali
Répondre
Fil
Voir

Click here to load this message in the networking platform