Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To Open A VFP Table With C#
Message
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Divers
Thread ID:
01133173
Message ID:
01133189
Vues:
12
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform