Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Open A VFP Table With C#
Message
General information
Forum:
ASP.NET
Category:
Databases
Miscellaneous
Thread ID:
01133173
Message ID:
01133189
Views:
11
I was hoping for some code too :)

Well, OK, since Christmas in July is upon us... ;)

First, get the provider and install it. http://msdn.microsoft.com/vfoxpro/downloads/updates/default.aspx

Second, here are two functions. You'll need to put a "using System.Data.OleDb;" at the top of your code.
DataSet dsResults = this.GetData("SELECT * FROM Orders WHERE CustomerID = <whatever>"); 



public DataSet GetData(string cSQLString)
{
OleDbConnection oConn = null;
DataSet DsReturn = new DataSet();

oConn = GetConnection(); 

oConn.Open();
OleDbDataAdapter oAdapter = new OleDbDataAdapter(cSQLString, oConn);
oAdapter.Fill( DsReturn);

return DsReturn;
}



public OleDbConnection GetConnection()
{
	return new OleDbConnection("Provider=VFPOLEDB.1;" + 
		"Data Source=c:\\MyFoxDataFolder ");
}
Lsat, but not least...if your employer/company can/will afford it, I recommend getting the PUTM membership for the UT. It will allow you to search all the posts on every forum - there are a number of ocde samples on this (and countless other) .NET topics.

Hope that helps...
Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform