Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Exporting to Excel format
Message
 
À
24/04/2006 13:02:57
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Divers
Thread ID:
01115863
Message ID:
01116073
Vues:
23
>>>Check KB306022 (and 306023 for C# version). You can transfer the data with or without excel installed. There is not something that exactly matches VFP's copy to ... xl5 but transferring with ADO.Net with an existing template file it's easy (that is you have a precreated and saved xls file with the layout of your table headers + row under it is defined with a name - you connect to this xls using Jet.Oledb driver).
>>
>>I have various export to do and they have data from various tables and fields. So, I guess this will not work.
>
>Michel,
>It'd. You can simply save it as an HTML (and excel2002 and up can also read a simple XML natively).
>Cetin


Ok, why not use the data handeling of .NET to do it for you?

1) rights to a folder to write details to.
2) rights t send that file out to browser.

// Establish a connection to the data source.
System.Data.OleDb.OleDbConnection objConn = new System.Data.OleDb.OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + m_strSampleFolder +
"Book7.xls;Extended Properties=Excel 8.0;");
objConn.Open();

// Add two records to the table named 'MyTable'.
System.Data.OleDb.OleDbCommand objCmd = new System.Data.OleDb.OleDbCommand();
objCmd.Connection = objConn;
objCmd.CommandText = "Insert into MyTable (FirstName, LastName)" +
" values ('Bill', 'Brown')";
objCmd.ExecuteNonQuery();
objCmd.CommandText = "Insert into MyTable (FirstName, LastName)" +
" values ('Joe', 'Thomas')";
objCmd.ExecuteNonQuery();

// Close the connection.
objConn.Close();

I was always thinking of AVOIDING office automation on the server. So this could do it for you in a more data direct manner.

__Stephen
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform