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: 1
Default Moving data from SQL Server to Excel

Hi,
I use this code to get the data from a SQL Server database and put it into a
spread sheet

' Get Geneneration Data
sSql = "Select Date,hh,Dartm1,Eildon1,Eildon2 from mdff_Generation_Xtab"
& _
" Where Date ='20051023' And Date < '20051030' Order By Date,hh"
rsADO.Open sSql, connMelbourne, adOpenStatic, adLockReadOnly

' Copy Data
rsADO.MoveFirst
Counter = 2
Do Until rsADO.EOF
Range("A" & Counter).Value = rsADO!Date
Range("B" & Counter).Value = rsADO!hh
Range("C" & Counter).Value = rsADO!Dartm1
Range("D" & Counter).Value = rsADO!Eildon1
Range("E" & Counter).Value = rsADO!Eildon2
Counter = Counter + 1
rsADO.MoveNext
Loop

I think there is a way of going straight to the spread sheet without going
through the load the record set copy to spread sheet route.

Any suggestions of a better way that does not involve so much work, there
are a lot of these to do?

Thanks MarkS
 
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
Moving linked files from one server to anoter one Gabriel Cisser Excel Worksheet Functions 3 October 6th 08 09:05 PM
Excel 2003 Error Cannot Locate the Internet Server or Proxy Server Seabee Excel Discussion (Misc queries) 0 November 20th 05 12:03 AM
Excel data to SQL Server marcmc Excel Programming 0 November 1st 05 04:28 PM
Excel VBA: moving folders on the server Myrna Rodriguez[_2_] Excel Programming 2 May 17th 05 01:47 AM


All times are GMT +1. The time now is 05:47 PM.

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"