Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

Here is one problem. I want to upload an excel file to the Sql server through c#. i want that configuration for the table should come from xml file.

How to do that. any sample code most welcome

Thanks in advance
sanjeev singh
Posted
Comments
Corporal Agarn 12-Jul-11 8:29am    
What have you tried?
[no name] 12-Jul-11 8:37am    
hello what i have did till now i.e i have taken data from excel to datatable and created follwing <Tables>
<Table CommandName="Get Users" Source="Usr" Target="User">
<column source="A" target="name">
<column source="B" target="descript">
<column source="C" target="address">
</Table>
<Table CommandName="Get Details" Source="Det" Target="Detail">
<column source="A" target="Id">
<column source="B" target="Detail">
<column source="C" target="anything">
</Table>
</Tables> xml file
now i want to use this file for assigning table and column name
How to do it

1 solution

You can upload it exactly like any other file — by a form with the input of the file type and the method "POST".

On server side, you can take this temporary Excel file and re-work in into HTML using tables and Microsoft Office interoperability. Start from here: http://msdn.microsoft.com/en-us/library/dd264733.aspx[^].

For working with Excel, see http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel%28v=office.11%29.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900