Load a range of cells into a dataset with an opened workbook instance.

S

sriram.rajamanuri

Hi,

I am kind of having to load a 'range' of cells into a dataset with an
instance of workbook that i have created. Is there a possibility that I
do it?

For eg.
Dim objExcel As New Excel.Application
Dim objWorkbook As Excel.Workbook
objWorkbook = objExcel.Workbooks.Open"C:foo.xls")
Dim objSheet1 As Excel.Worksheet = objWorkbook.Worksheets("Sheet1")
...
' Do some operations in the cells in the worksheet
...

Dim sConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<THIS IS WHERE I WANT TO
GIVE A RANGENAME FROM objWorkBook>;Extended Properties=Excel 8.0;"
...
load the data into dataset etc.
Dim objCmdSelect As New OleDbCommand("SELECT * FROM RangeName",
objConn)



Any ideas?

Thanks in advance,
Sriram
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top