1717
FAQ [Internet]
On this page are placed the answers to questions which I cruelly (or easy) found, I do not think, that the answers are exhausting, and if you will find, that something not conform to your representations, let's discuss and we shall find the best decisions... Besides frequently answer can depend on the version as OS and Visual FoxPro, to check up all on all versions and platforms for me simply excessively. Initially this list was only for VFP 5.0, while now it only VFP 7.0/8.0, I could somewhere and miss a mention of the version, and if you will find discrepancies, inform me, please.

 

Q: I'm beginner in VFP 6.0 and me interest opportunities on use ADO and OLE of objects in Internet, how I can take advantage VFP in ASP? 

A: In ASP you can use VFP-COM objects just as also anyone others, is like: var ob = Server.CreateObject ("VfpOleObject"); However I have understood so, that you interests uses tables/views from VFP database. It you can do creating ADO RecordSet's for VFP sources of the data: (var oc = Server.CreateObject ("ADODB.Connection"); oc.Open (sVfpODBCConnctStr); etc.) If you are interested a question of creation of html-pages by means VFP. It has the large set of Wizards, classes, and FoxIsapi for these purposes. See also http://www.west-wind.com/ ...And it is a lot of another about VFP in Internet. For transformation ADO RecordSet in VFP cursor you can take advantage http://msdn.microsoft.com/vfoxpro/downloads/download.asp?ID=025. See also http://support.microsoft.com/kb/q197861/

Q: In VFP 7.0 is two new functions: CursorToXML() & XMLToCursor() using first of them I have receive the xml-file for the table, however how view it in IE. 

A: To view the xml-file in IE it is necessary to define format of map of datas and it is possible to make by using css or xls files.Try to do the following:
- open table HOME(2)+"tastrade\data\setup.dbf"
- from Command window enter: ?CursorToXML("Setup", "myXMLSetup.xml", 1, 8+48+512, 0, "myShmSetup.xsd")
- create new file with text below:
<?xml version="1.0"?>
<!-- File Name: myXMLSetup.xsl -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<H2>List VFP table Setup</H2>
<xsl:for-each select="VFPData/setup">
<SPAN STYLE="font-style:italic">key_name: </SPAN>
<xsl:value-of select="key_name"/><BR />
<SPAN STYLE="font-style:italic">value: </SPAN>
<xsl:value-of select="value"/><P />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
save this as myXMLSetup.xsl file
- insert to myXMLSetup.xml file line:
<?xml-stylesheet type="text/xsl" href="myXMLSetup.xsl"?>
as line number two
-at last is possible to try to open the myXMLSetup.xml file from IE.
Other method consists in writing for myXMLSetup.xml the css-file, for example:
/* File Name: myXMLSetup.css */

key_name
{display:block;
margin-top:12pt;
font-size:10pt}

value
{display:block;
font-size:12pt;
font-weight:bold;
font-style:italic}
and use it instead of xsl shown above.
See also
- Q253732 HOWTO: Use FoxPro and MSXML to Return Information About an XML Document
- Q191758 Convert FoxPro Cursor into XML Data Format
- Q253713 Move Data From an XML Document into a FoxPro Table
in MSDN.
Is necessary also to have in view, that the construction of type:
<SCRIPT LANGUAGE="JavaScript">
var doc = dsoData.XMLDocument;
...
<XML id="dsoData" src="Data.xml"></XML>
actually returns as a value of variable doc is object DOMDocument (i.e. "MSXML.DOMDocument"). How to be spoken do not trust own eyes :-)

Q: At attempt to use VFP 8.0 OLEDB Provider from under MS IIS (OS Windows 2003 Server) I receive: System.Data.OleDb.OleDbException: No error information available: REGDB_E_CLASSNOTREG (0x80040154). If to create the usual Windows-application (for example on C#) with access through System.Data.OleDb), all works without questions. Whether there is a way of struggle with it? 

A: Some variants of overcoming this problem are known for me:
1) Instead of VFP 8.0 OLEDB Provider to use VFP OLEDB Provider for version 7.0
2) In the machine.config file in section processmodel change UserName with MACHINE on SYSTEM
3) Instead of VFP 8.0 OLEDB Provider 8.0.0.3006 use VFP OLEDB Provider 8.0.0.3117 (SP1VFP8) or later from http://msdn.microsoft.com/vfoxpro/downloads/updates/default.aspx Pay attention, that the rights of the local administrator (NOT the domain admin or network admin account) of a server are necessary for correct registration of OLE-component to you.
It seems, the second variant is not necessary try to use because of reasons of safety.

Q: How from VFP-code download the file from an internet-resource, having its address? 

A: For VFP immediately such built-in possibility it's not present, but
- first, from VFP it is possible to call Win32API-functions
- Secondly, in VFP it is possible to use ActiveX of the component, specialized for similar operations

Rather first:
There are at least two sets of functions: MS WinSock and MS WinInet (see in MSDN), usage first is hampered because of necessity to pass structures through parameters (in this occasion it is possible to look struct.zip by Christof Lange in internet), whereas second easily enough, see for example: on ftp://ftp.prolib.de/ tools/archive/internettools/ vfphttp.PRG, ftp_test.prg, ftp.PRG. See also in MSDN - [Q174524] "HOWTO: How To Retrieve and Insert HTML Into Memo Field".
... Concerning any of an example with MS WinSock - see example on http://vfpdev.narod.ru/util_r.html - getip.zip (1,69KB) - class for obtaining IP address for any host name, with usage Windows Sockets 2 API

Rather secondly:
from MS I know two components in this direction: MsWinSck.ocx, MsInet.ocx
See examples MSDN Knowledge Base:
- [Q311306] HOWTO: Use Visual FoxPro to Download a Web Page from the Internet
- [Q315124] SAMPLE: Use the Winsock ActiveX Control with Visual FoxPro
See also examples on http://vfpdev.narod.ru/util_r.html
- smtp.zip (20,8KB) - the example demonstrates sending the message through the SMTP protocol, using MS WinSock control.
- tcpSock.zip (12,5KB) - example of the client and server with usage MS Winsock control (MsWinSck.ocx) VFP6.0+SP3(VS6)/VFP7.0(SP1VFP7)
- srvwinsk.zip (100KB) - example of the applications of the client and server with usage MS Winsock control (MsWinSck.ocx) VFP 8.0/VFP 9.0
As addition, there it is possible to see: wsDmur.zip (49,5KB)
 
 
Hosted by uCoz