CopyFromRecordSet has Invalid Cast Exception

-1

I have a dataset produced from an SQL script and I am trying to output one column to a column in Excel. The record set produces one column with a max of 228 records at any given time.

Currently this is the code that I am using (in the code i is the excel column number which is always set ):

myWkBook.Sheets(Row.Item("intTypeSort")).Cells(5, i).CopyFromRecordset(myResultsDS.Tables(0))

I am being thrown the error:

No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))

Any ideas?

excel
vb.net
dataset
asked on Stack Overflow Jan 25, 2019 by Matt Bartlett

1 Answer

0

The way I've added a value to Excel is to do: worksheet.Cells(5, i).value = "SomeValue"

So you could loop through your DataSet and add the values manually.

I'm not to sure what Row.Item("intTypeSort") is trying to do.

answered on Stack Overflow Jan 25, 2019 by Daffas

User contributions licensed under CC BY-SA 3.0