I built a tiny COM component in VFP that reads Fox 2.6 tables and returns XML. In .NET, I read that XML and create DataSet object.
Here is the code:
FoxPro:
LPARAMETERS tcSQL AS Character
LOCAL lcData AS Character
lcData = ""
*-- Execute SQL Statement
&tcSQL
IF USED("RESULT")
=CURSORTOXML("RESULT", "lcData", 1, 0, 0, "1")
USE IN RESULT
ENDIF
RETURN lcData
.NET
public static DataSet GetLocalData(string tcSQL)
{
DataSet loDataSet = new DataSet();
vfpboss.vfpdata loCOM = new vfpboss.vfpdata();
string lcXML = (string) loCOM.getxml(tcSQL);
if (lcXML != String.Empty)
{
StringReader loStream = new StringReader(lcXML);
XmlTextReader loXmlTextReader = new XmlTextReader((loStream);
loXmlTextReader.WhitespaceHandling = WhitespaceHandling.None;
loDataSet.ReadXml(loXmlTextReader,XmlReadMode.ReadSchema);
loStream.Close();
loXmlTextReader.Close();
}
return loDataSet;
}
>Problem de jour!
>
>On a regular basis I need to be able to open and read incoming FoxPro 2.6 tables within a VB.NET application (the 2.6 tables are coming from end-user VFP6 applications - they are 2.6 files because of a legacy SAS application) The original application that performs this operation is written in VFP6 and our current contract requires us to move everything into .NET -- I am in the beginning stages of getting my feet wet with .NET and the only method that I see thus far is ODBC (I'm not really thrilled about using it).. OLEDB only works if I have an intermediate routine that pushes the 2.6 files into DBC and the JETOLEDB supports just about everything (dBase, Paradox, etc..) except FoxPro.. nice huh?
>Any suggestions?
>
>-- Len Wooden
- Jayesh