Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO access slow
Message
De
04/09/2003 06:43:59
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
03/09/2003 06:42:15
Barry Newton
Plan International
London, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00825572
Message ID:
00825938
Vues:
24
>hi cetin
>i'm doing it this way because the data is clipper and on an advantage database server (ps. C:\TEMP\ was just an example). it's the only way i can access the live data without getting errors (see:821289).
>this whole thing's proving to be trickier than i first thought.
>kind regards,
>barry

Barry,
OK reading that thread I see you can only succeed with OLEDB driver. JVP's note about a million record counts of course but that really might be your need OTOH.
Now no matter how many records you have you want to report on it, right ? There are options like reporting via a different report tool :
-Plain textmerge processing
-Textmerging HTML
-Reporting via Excel or OWC
-Crystal Reports etc

Thinking you still want to use native VFP report writer you might cheat to distribute conversion time into reporting time 'by no conversion into a VFP cursor' :)
VFP report writer processes as many detail lines as current cursor has and it doesn't care if you're really reporting items from that cursor/table or not. You might be using anything in your report, fields, arrays, objects etc. IOW it doesn't care if your expression is myCursor.myField or myObject.myCollection(nIndex).myProperty or myArray[nIndex]. Nice thing about report is that it's a command, not a separate procedure. It means it could access all the variables (including locals) that are accessible by the routine it's called.
For a moment think your oRS has 'f1, f2, f3' fields and 100 rows are returned :
local lnRecs
lnRecs=0
oRS = oConn.Execute('select * from sales',@lnRecs)
Create cursor dummy (dummy l)
For ix=1 to lnRecs
  Insert into dummy values (.f.)
EndFor
oRs.MoveFirst
Scan
    ? oRS.Fields("f1").Value, ;
      oRS.Fields("f2").Value, ;
      oRS.Fields("f3").Value
    oRs.MoveNext
endscan   
oConn.Close
Scan...endscan loop represents what the report would do. In your report you then instead of using 'f1' as a field expression you'd use oRS.Fields("f1").Value. On exit of detail band you'd call oRs.MoveNext and adding a summary band you'd call oRS.MoveFirst on exit. To say that more clear with a sample :

-Create a new report called ADOReport.frx
-In detail band add 2 fields with expressions :
oRS.Fields('cust_id').Value
oRs.Fields('company').Value
-Dblclick detail band and enter this for 'On exit'
oRs.MoveNext
-Add a summary band
-DblClick summary band and enter this for 'On exit'
oRs.MoveFirst
-Save the report
-Code and run (change testdata.dbc path as necessary) :
lcConnStr = 'Provider=VFPOLEDB;Data Source='+;
  _samples+'data\testdata.dbc'

Local oRS as adodb.recordset
Local oConn as AdoDb.connection
oConn = CreateObject('Adodb.connection')
oConn.ConnectionString=lcConnStr
oConn.Open
Local lnRecs
lnRecs=0
oRS = oConn.Execute('select * from customer',@lnRecs)
Create cursor dummy (dummy l)
For ix=1 to lnRecs
  Insert into dummy values (.f.)
EndFor

oRs.MoveFirst
Report Form adoreport preview
oConn.Close
PS: I don't know what the converters you use are doing. 100 recs in 5 secs sounds slow to me. It might be true rarely depending on data but seeing name as sales I suspect it'd have that much huge data per record.
VFP8 cursoradapter supports ADO :)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform