LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default SQL CopyFromRecordset

My Excel program is a front end to a SQL backend.
Users run various reports that execute stored procedures in SQL server.
My question is I use the "copyfromrecordset" code to autofill the returning
recordsets into a worksheet however they dont return the column headers.
How do I get the column headers either from VBA Excel or from the SQL stored
procedures. The stored procedures are just simple "Select * from" statements.

here is the code that works but has no headers.
myConnection.Open
Set myCommand.ActiveConnection = myConnection
Set myRecordSet.ActiveConnection = myConnection
myCommand.CommandText = strSQL
myCommand.CommandType = adCmdText
myCommand.Execute
myRecordSet.Open myCommand

'Paste to spreadsheet
ThisWorkbook.Worksheets("Report").Range("a2").Copy FromRecordset
myRecordSet

thanks for any help

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CopyfromRecordset MattShoreson[_67_] Excel Programming 2 March 15th 06 01:36 PM
CopyFromRecordset Ernst Guckel[_4_] Excel Programming 3 May 1st 05 08:03 PM
CopyFromRecordset does nothing Hafeez Excel Programming 2 August 13th 04 07:20 PM
CopyFromRecordset does nothing E Harris Excel Programming 5 January 8th 04 04:29 PM
Copyfromrecordset Bug ? news.btx.dtag.de Excel Programming 1 August 1st 03 07:44 PM


All times are GMT +1. The time now is 03:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"