Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I do this for a VFP7.0 DBC?
Message
De
16/03/2002 15:50:51
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Titre:
How do I do this for a VFP7.0 DBC?
Divers
Thread ID:
00633787
Message ID:
00633787
Vues:
44
Hi All,

I'm a newbie at this .Net stuff and am following some sample exercises in an ASP.NET book. The samples use C# which is ok by me (I'm new at that too). In a chapter entitled "DISPLAY SQL DATA" the sample used a System.Data.SqlClient namespace. I understand that this is to be used when talking to SQLServer. My problem is, how do I do something similar to talk to a VFP7.0 DBC?

Thus far, I've been able to use the VBSCRIPT shown below to create a table on a webpage (not all code is shown):
   Set Conn = Server.CreateObject("ADODB.connection")
   ConnStr= "Driver=Microsoft Visual Foxpro Driver; UID=;SourceType=DBC;SourceDB=C:\csharp\Data\pma.dbc"
   Conn.Open ConnStr   'This can be a datasource name or a connect string
   Set cmdTemp = Server.CreateObject("ADODB.Command")
   Set rs = Server.CreateObject("ADODB.Recordset")
   SQLText="Select pibase.street,pibase.from,pibase.to from pma!pibase"
   cmdTemp.CommandText = SQLText
   cmdTemp.CommandType = 1 'SQL statement
   Set cmdTemp.ActiveConnection = Conn
   rs.CacheSize = 10
   rs.Open cmdTemp,,adopenstatic
However, the ASP.NET sample doesn't do it this way and it load a DataGrid using a DataSet. The C# code seems to be so much "easier" and uses less lines of code as shown below:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

protected void Page_Load(Object sender, EventArgs e) {
	SqlConnection sqlconnectionPubs = new SqlConnection("server=(local)\\NetSDK;uid=QSUser;pwd=QSPassword;database=pubs");

	SqlDataAdapter sqldataadapterTitles = new SqlDataAdapter("select title, notes, price from titles where type='business'", sqlconnectionPubs);

	DataSet datasetTitles = new DataSet();
	sqldataadapterTitles.Fill(datasetTitles, "titles");

	datagridTitles.DataSource=datasetTitles.Tables["titles"].DefaultView;
	datagridTitles.DataBind();
}
</SCRIPT> 
All comments and suggestions are greatly appreciated.

TIA

Mike
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform