Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataTable2Dbf
Message
De
20/02/2004 12:42:42
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Titre:
DataTable2Dbf
Divers
Thread ID:
00879337
Message ID:
00879337
Vues:
49
Greetings.

I think what I am trying to do is rather simple, but as of now, I have not been able to accomplish it.

I want to save a Ado.Net DataTable created from a SqlDataAdapter as a VFP dbf.

This was easy to accomplish in the previous implementation using Sql Passthrough from fox.
*& Old Way
lnSuccess = SQLEXEC(nHandle, Select top 1 * from Entities, "cResult")
IF lnSuccess>0
        SELECT cResult
	COPY TO OutputFile.dbf
ENDIF
From .Net, I want to accomplish the same thing through the VFP OLEDB Provider. I am trying to avoid doing a create table and then foreaching each row to do an insert. I just want to send the DataTable to a dbf.
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand("Select top 1 * from Entities", sqlconDest);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);

// of course this won't work....
//OleDbCommand cmd2 = new OleDbCommand("Select * from (dt) into OutputFile.dbf", oledbcon)
My alternatives seem to be either Serializing the DataSet to xml and calling a VFP COM object to parse the xml and create the table (wanted this to be all managed code), or using DTS to create the table, and then copy it from the SQL Server (currently the application server has no connections to sql server).

If anyone else has had to accomplish roughly the same thing, I would sincerely appreciate your input.

TIA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform