Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to do cascading FoxPro queries in .NET
Message
General information
Forum:
ASP.NET
Category:
Migration
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01595691
Message ID:
01595730
Views:
37
>
>My real question here is the case where (1) the data is in FoxPro and (2) I cannot use the VFP EF Provider. That leaves me using VFP Oledb. How does one use Oledb in the case where one query builds off of the previous one.
>

Have you tried looking at the code pages to speed up your queries? Honestly being able to project the results into something like a List<T> instead of a DataTable is a LOT nicer to deal with (when using VFP EF vs raw OLEDB).

The easiest way to get the results from a series of queries that are built on previous ones would be to add a stored procedure into the DBC, then call that from the .NET side.

Something like:
FUNCTION spTest()
   SELECT * ;
     FROM Orders ;
     INTO CURSOR curTest
     
   SELECT * ;
     FROM curTest ;
     INTO CURSOR curT2 ;
    WHERE Cust_ID = "LINOD "
    
   SETRESULTSET("curT2")
ENDFUNC
The .NET code:
var table = new DataTable();

using(var db = new System.Data.OleDb.OleDbConnection())
{
	db.ConnectionString = @"Data Source=C:\Program Files (x86)\Microsoft Visual FoxPro 9\Samples\Data\testdata.dbc;Provider=VFPOLEDB;Collating Sequence=MACHINE;Mask Password=False;persist security info=False;Mode=Share Deny None;Extended Properties=;Encrypt Password=False";
	db.Open();
	using (var cmd = db.CreateCommand())
	{
		cmd.CommandType = CommandType.StoredProcedure;
		cmd.CommandText = @"spTest";
	
		using (var adapter = new System.Data.OleDb.OleDbDataAdapter(cmd))
		{		
			adapter.Fill(table);
		}
	}
}
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform