Control Panel
Forum
Hosting Help
ASP.NET 4 & SQL 2008 R2 Hosting
Resources
Notice
Login
Members
Shared Hosting
|
New Features
|
Advertise
|
Tutorials
|
Silverlight Tutorials
|
Product Reviews in India
|
Exam 70-680 Practice Tests
|
Silverlight games
Total
members
:
153448
Average new registrations per day (in last 7 days):
96
New Registration:
Open
Register Now
Learn Windows 7:
System requirements for ZoneAlarm Extreme Security 2010
In this resource I Will give System requirements for ZoneAlarm Extreme Security 2010
Want to become a DBA ?
SQL Server 2008 training courses
- by AspSpider team
Home
»
Resources
»
.xml file upload into database and dataset download into .xls formate
ASP.NET
ADO.NET
Web Services
Remoting
Visual Studio 2005
Error Bank
Interview Questions
Tips & Tricks
XML
HTML
Jscript/Javascript
IIS
Windows
General
Submit Resource or code snippet
... and get
surprise gifts
Win Digital camera, ASP.NET Books, Free softwares!!
.xml file upload into database and dataset download into .xls formate
30 Mar, 2010
Author:
rahul kumar
http://aspspider.info/rahulchoudharycs
millennum
Summary
.xml file upload into database means browess .xls file from system and save it into database and download records from database into .xls formate
.NET Classes used :
using system.io.StringWriter;
#9(.xls upload into database)
string strConn;
strConn =
//full path where .xls save in server
Provider=Microsoft.Jet.OLEDB.4.0; + Data Source= mysheet.xls ; + Extended Properties=Excel 8.0;;
//tablename =your .xls name
OleDbDataAdapter myCommand = new OleDbDataAdapter(SELECT * FROM [ tablename$], strConn);
DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet, ExcelInfo);
DataTable dt = myDataSet.Tables[ExcelInfo];
Check_column(dt);
FileInfo TheFile = new FileInfo(mappa);
if (TheFile.Exists)
{
File.Delete(mappa);
}
dt.Clear();
}
#10(data download into .xls formate from gridview)
protected void ExportToExcel()
{
HtmlForm form = new HtmlForm();
string attachment = attachment; filename=MySheet.xls;
Response.ClearContent();
Response.AddHeader(content-disposition, attachment);
Response.ContentType = application/ms-excel;
StringWriter stw = new StringWriter();
HtmlTextWriter htextw = new HtmlTextWriter(stw);
//gvFiles is a gridview
form.Controls.Add(gvFiles);
this.Controls.Add(form);
form.RenderControl(htextw);
Response.Write(stw.ToString());
Response.End();
}
Feedbacks about this page from members:
- No Feedbacks yet !! -
Submit Feedback
View All Feedbacks
Advertise
Privacy Policy
Terms of use
Contact Us
SpiderWorks Technologies Pvt Ltd.
All Rights Reserved.