Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DLL in Foxpro - Tables in App, UI functions
Message
From
12/11/1998 10:53:46
 
 
To
12/11/1998 04:03:25
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00156508
Message ID:
00156981
Views:
55
>OK Thanks.
>I understand taht I cannot do UI.
>
>that's OK.
>
>WHat's more important is that I need to return a cursor
>to the calling program.
>
>How can I do this.
>
>When I create the cursor via a SQLEXEC it works OK. (No errors)
>
>I tried it from a form and the command window but
>both don't know about the cursor. I can't select it.
>
>How can I return a cursor?
>
>PS I also tried.
>DEFINE class cursor AS cursor OLEPUBLIC
>PROCEDURE init
> LPARAMETERS lnConnectionHandle,dest
> temp="mainkey='Womens Wear*23809-1'"
> LSQL='PDMSELECTWO measure,"'+ temp +'"'
>
> nerror=SQLEXEC(lnConnectionHandle,LSQL,this.alias)
> select &dest
>
> IF nerror!=1
> AERROR(aErrorArray)
> lcerrorstring="SQL Server Error : "+STR(aErrorArray(1,1))
> lcerrorstring=lcerrorstring+aErrorArray(1,2)+CHR(13)
> lcerrorstring=lcerrorstring+aErrorArray(1,3)+CHR(13)
> RETURN lcerrorstring
> ENDIF
>
> RETURN
>ENDDEFINE
>
>SO I can do a craeteobject() and get my cursor.
>But I guess I just don't know what I'm doing.
>
>Thanks for the help!

Cursors are not a valid parameter type in VFP. The problem you are having is because your SQLEXEC command in your dll object is creating a table in that object's own private datasession, and other processes can't see cursors in that datasession.

If passing cursors between COM objects is something that you really feel you need to do, then you should be looking at ADO. An ADO recordset is an object and can be passed around as such. Although you cannot SELECT an ADO recordset and perform native VFP DML commands on it, you can convert VFP cursors to ADO recordsets and vice-versa. So your COM object could create an ADO recordset from your remote data, pass it back as an object to the client program, and the client program could convert the recordset into a VFP cursor.
There are a couple of articles and downloadable sample files on ADO here in the knowledgebase and in the files section.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform