Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is ADO faster than VFP 6
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00934351
Message ID:
00934397
Vues:
28
Hi Houston,

Here are the codes.



Here is VFP 6 Source code:
pp = val(strtran(time(), ":", ""))
use C:\Projects\Lagger-3d\Desurvey\Desurvey

Replace all Elev With 23.99
pp2 = val(strtran(time(), ":", ""))
? pp2 - pp
Here is VC++ source code:
   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 ();
      time_t ltime, ltime2;
	  time(<ime);

      _RecordsetPtr   spRS;
      _ConnectionPtr  spCON;
      try{
         CREATEiNSTANCE(spCON,Connection);

		 CString cintermed = "Provider=vfpoledb.1;Data Source="+pathName;
		  
 		 spCON->ConnectionString = cintermed.AllocSysString();
         HRESULT hr = spCON->Open ( "", "", "", -1 );
  		 if(!SUCCEEDED(hr))
		 {
		     MessageBox("Could not read from the file: \"" + pathName +  "\"", "North Face Software", MB_OK);
			 return;
		 }

         CREATEiNSTANCE(spRS,Recordset) 
         spRS->PutRefActiveConnection( spCON );

 		 
		 _RecordsetPtr rcs;
		 _CommandPtr cmd;
		 
		 _variant_t vNull(0L);
		 vNull.vt=VT_ERROR;
		 vNull.scode=DISP_E_PARAMNOTFOUND; 
		 rcs.CreateInstance(__uuidof
		 (Recordset));
		 cmd.CreateInstance(__uuidof
		 (Command));
		 cmd->ActiveConnection=spCON;
		 cmd->CommandType=adCmdText;
		 cmd->CommandText = "UPDATE "+ (_bstr_t) fileName +" SET Elev = 23.99";
		 rcs=cmd->Execute(&vNull,&vNull,adCmdUnknown);
		 time(<ime2);
		 char  buffer[200];
		 sprintf(buffer, "Time in seconds since UTC 1/1/70:\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); 
	  }           
   }	
>>Hi Everybody,
>>
>>Today I tried to find out which one was faster, ADO or VFP 6. Therefore, I created a table with 112089 records. I ran the following command:
>>
>>use MyFileName
>>Replace all FieldName With 23.99
>>
>>It took 5 second in VFP 6.
>>
>>Then, I restarted the computer and run the required ADO commands to access a dbf file in VC++ along with the following commands:
>>
>>
>>cmd->CommandText =
>>"UPDATE "+ (_bstr_t) MyFileName +" SET FieldName = 23.99";
>>rcs=cmd->Execute(&vNull,&vNull,adCmdUnknown);
>>
>>It took 14 seconds.
>>
>>I thought ADO should be faster or at least the same as VFP 6 because ADO goes directly to OLE DB.
>>
>>Did I do something wrong or you got the same results?
>>
>>Thank you,
>>Ali
>
>Can you post all of your VFP code - including the elapsed time code?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform