all
Business
Careers and Education
IT
Apache Web Server
Content Management Systems
IIS / Microsoft Internet Information Services
Mac OS X
Microsoft Windows / Windows 7 / Vista / XP
Networking
Unix / Linux / BSD
Development
.NET Framework
ASP / Active Server Pages
ASP.NET
Algorithms / Advanced Math
C / C++
C# / C Sharp
ColdFusion
DB2 Database
Flash / Actionscript
HTML / CSS
Java
JavaScript / Ajax / DHTML
Microsoft Access / VBA
Microsoft SQL Server
Mobile Development
MySQL Database
Oracle Database
PHP
Perl
PostgreSQL Database
Python
Ruby / Ruby on Rails
Software Development
Visual Basic .NET
Visual Basic 4 / 5 / 6
XAML / WPF / Silverlight
XML
sign up
login
new member:
Register
member login:
Email Address:
Password:
lost password?
bytes
>
asp.net
>
asp.net questions
Import Excel file to Gridview
orked
Join Date: Jan 2009
Posts: 40
#
1
: Mar 18 '09
i tried to import excel file into gridview but the code made this exception (Failed to map this path''xmlTest.xml") i don't know why
my code:
Expand
|
Select
|
Wrap
|
Line Numbers
public void fillGrid()
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("../xmlTest.xml"));
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
fillGrid();
}
}
protected void btImport_Click(object sender, EventArgs e)
{
string conn = ("Provider=Microsoft.Jet.OLEDB.4.0;" + ("Data Source=C:\\WebSqlEditor\\test.xls;" + "Extended Properties=Excel 8.0;"));
string SSQL = "SELECT name , dept, salary from [sheet1$]";
OleDbDataAdapter oleDA = new OleDbDataAdapter(SSQL, conn);
DataSet ds = new DataSet();
oleDA.TableMappings.Add("Table","ExcelTest");
oleDA.Fill(ds);
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
}
what i can do?
thanks
YonngTyler
Join Date: Aug 2010
Posts: 2
#
2
: 1 Week Ago
re: Import Excel file to Gridview
I suggest to use a*
c# excel
component Spire.XLS, I use it long time, quit good.
It*supports importing/exporting to XLS, XLSX, CSV and HTML files.
May help to you.
«
previous question
|
next question
»
Similar topics
import excel file
(
C# / C Sharp answers
)
Open Excel file as read only
(
ASP.NET answers
)
exporting GridView to from UpdatePanel of a page having one master to Excel file
(
.NET Framework answers
)
Access Can't Import An Excel File Unless It Is Open
(
Microsoft Access / VBA answers
)
export gridview images to excel
(
.NET Framework answers
)
Export GridView to Excel Error
(
ASP.NET answers
)
Error in IE outputting to Excel
(
ASP.NET answers
)
Export and Import from Excel into a Web page
(
ASP.NET answers
)
Type conversion problems with Access Import Wizard
(
Microsoft Access / VBA answers
)
More
Latest Questions
Latest Expert Insights
Need Help with Bytes? (FAQ)
Copyright 1995-2010 BYTES. All rights Reserved
About Bytes
|
Help
Latest Expert Topics
|
Popular Tags
Sitemap
|
ASP.NET Answers Sitemap
|
ASP.NET Insights Sitemap