Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return a VFP cursor to ASP script
Message
De
27/05/2002 09:51:01
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00661367
Message ID:
00661667
Vues:
23
>>>Assume I have a VFP COM Server being used by some ASP scripts. What's the best way to return a VFP cursor (or at least the contents of a VFP cursor) to an ASP script such that the contents are structured and therefore accessible as rows and columns like an ADO recordset object? I've seen posted here that VFPCOM is not reliable as a cursor-to-recordset translator. Thanks very much.
>>
>>Mark,
>>I think you've answered yourself. Directly use OLEDB driver for ODBC.
>>In VFP7 there are more options like OLEDB drv. for VFP, cursortoxml(), xmltocursor() etc.
>>Cetin
>
>Cetin, could you show me how to approach this situation: I have a bunch of ASP code that is written to work with a recordset that is generated from some DBFs. Because of some business logic changes, it has become a real problem to generate the recordset using SQL within ASP. However, using the VFP engine on this set of loosely related tables works great. So I want to use the VFP engine to create a cursor, and then convert the VFP cursor to an ADO recordset to pass back to my ASP application.

Isn't it too much work. First a cursor, convert to rs and pass back the rs. I think with this approach you'd need to build a rs rather than using something like :

set oRs = oConn.Execute("select ...")

VFPCOM might be slow and if that's the only problem. On VFP side save to a temp table which you pass the name during call. ie:
&lt%
    dbpath = Server.MapPath("data")	

    cTableName = dbpath+"\myTemp.dbf"
    myVFPCOM.myProc( cTableName ) && COM would select into 'table'

    set oConnection = Server.CreateObject("adodb.connection")

     with oConnection
    	.Provider="MSDASQL"
    	.ConnectionString = "Driver={Microsoft Visual FoxPro Driver};UID=;PWD=;" & _
		"SourceDB="+dbpath+";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;"
    	.Open
       .Errors.Clear	
       Set rs = .Execute( "select * from myTemp.dbf" )
    end with

    oConnection.Close
    set oConnection = nothing
%&gt
Or create and pass the connection, rs objects to VFP so it gives you back filled rs. I don't know if you could create a fast one w/o a connection (I guess you can't otherwise VFPCOM would do it).

Honestly I don't use ASP + VBscript at all so someone else might have a much better idea.
PS:Explicitly used DBF type in code to show you could do that with free tables and faster than a standalone rs.
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
Répondre
Fil
Voir

Click here to load this message in the networking platform