Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel CopyFromRecordset in VB.NET

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,569
US

I have this line of code in VB 6 that works great if I want to have a (ADO) recordset displayed in Excel:
Code:
xlApp.Sheets(1).Range("A2").CopyFromRecordset rst
Is it possibile to have it with dataset's table in VB.NET?

Have fun.

---- Andy
 
Not that I know of. The CopyFromRecordset method of the Excel library was probably added well before DataTables were in use, and ADO goes will with VBA, which is what Excel uses. You should be able to write a function to loop through the DataTable and Excel cells.
 

Thanks RiverGuy, I was afraid it was the case.....

Have fun.

---- Andy
 
Yeah, MS didn't want you to eaily work back to a recordset from a DataTable, but you can fill a DataTable from a recordset. Like RiverGuy said the only way is to loop through.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top