|
Subject:
|
Opening Excel file
|
|
Posted By:
|
p2pMember
|
Post Date:
|
1/9/2006 9:40:22 AM
|
hi ther; please tell me how to open Excel file in asp.net. The file is on different server if the file is on localhost it is possible to open it but how it can be done when that file located somewher else?????
|
|
Reply By:
|
sanajmshaji
|
Reply Date:
|
1/21/2006 12:54:19 PM
|
Create a data grid and name it as dg and add the following code to Load event of the web page It will work fine and see the result
Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\datatest.xls;Extended Properties=Excel 8.0;" Dim objConn As New OleDbConnection(connstr) Dim objadap As New OleDbDataAdapter("SELECT * FROM Range1", objConn) Dim ds As New DataSet objConn.Open() objadap.Fill(ds, "ExcelData") dg.DataSource = ds.Tables(0).DefaultView dg.DataBind() objConn.Close()
sanajmshaji
|