Creating a Data Source

  • Thread starter Thread starter Mel
  • Start date Start date
M

Mel

I have Visual Basic code in the Page_Load event that makes a
connection to an Excel 11.0 file. Is it possible to do the equivalent
using a data source so it existed on the form? If so, how? A data
source would be handy since I need to retrieve the Excel data from
many procedures/functions in my VB code.

Dim appExcel As New Excel.Application
Dim wkbExcel As Excel.Workbook

appExcel = CreateObject("Excel.Application")
appExcel.Visible = False
wkbExcel = appExcel.Workbooks.Add("c:\support\Span Tables.xls")
 
I have Visual Basic code in the Page_Load event that makes a
connection to an Excel 11.0 file. Is it possible to do the equivalent
using a data source so it existed on the form? If so, how? A data
source would be handy since I need to retrieve the Excel data from
many procedures/functions in my VB code.

Dim appExcel As New Excel.Application
Dim wkbExcel As Excel.Workbook

appExcel = CreateObject("Excel.Application")
appExcel.Visible = False
wkbExcel = appExcel.Workbooks.Add("c:\support\Span Tables.xls")

This cannot be done in ASP.NET, as server-side Office Automation doesn't
work - Microsoft will not support any solution which attempts to do this...
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

Instead, use ADO.NET or Aspose:
http://www.google.co.uk/search?sour...rlz=1T4GGIH_en-GBGB220GB220&q=Excel+"ADO.NET"
http://www.aspose.com/Products/Aspose.Cells/Default.aspx
 
Back
Top