protected void Page_Load(object sender, EventArgs e)
{
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\temp\\deltamed.xls;" +
"Extended Properties=Excel 8.0;";
//You must use the $ after the object you reference in the spreadsheet
OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);
DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet, "ExcelInfo");
DataGrid1.DataSource = myDataSet.Tables["ExcelInfo"].DefaultView;
DataGrid1.DataBind();
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server">SpreadSheetContents:</asp:Label><br />
<asp:DataGrid ID="DataGrid1" runat="server" />
</div>
</form>
</body>
</html>
Aklımda Kalası Kelimeler
* давайте работать вместе
* Zarf ve Mazruf, Zerafet(xHoyratlık) ile aynı kökten(za-ra-fe) gelir
* Bedesten
* Suç subuta ermiştir - Suç sabit olmuştur
16 Mart 2011 Çarşamba
ASP.NET ile Excel import
Ref: http://www.aspfree.com/c/a/ASP.NET-Code/Read-Excel-files-from-ASPNET/
Kaydol:
Kayıtlar (Atom)