Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 18th, 2003, 08:47 PM
vrkelley vrkelley is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 38 vrkelley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Pass Oracle ADO data from VB6 to Excel

Is there a way to save ADO data directly to an excel spread sheet?

Tryiing to
1. use VB to do the query to oracle DB.
2. Save the resulting recordset to a new EXCEL spreadsheet
(which can be open for the person to see).

Is there an easy to do this?
Thanks in advance

Reply With Quote
  #2  
Old April 19th, 2003, 01:27 AM
vrkelley vrkelley is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 38 vrkelley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
This works manually but I have to spell out every Oracle column to fill excel columln. How I dump the whole oracle row to a excel spread sheet?
How do I show the Oracle Column names?

Code:
Dim rtnValue As String
Dim strReturn As String
Dim strSQL As String
Dim ado_rs As ADODB.Recordset
Dim o As Object
Dim Row As Integer
Dim strRange As String
Dim Rscolumn As Integer
Row = 1
Rscolumn = 0

Set o = CreateObject("excel.application")
strSQL= “Select Date as Date, part_number  as P/N, Location as Station, etc from TblLocation”

If fnPassSQL(strSQL, ado_rs) Then
      o.Visible = True
      o.Workbooks.Add   

      While Not ado_rs.EOF
        strRange = "A" & Row & ":A" & Row <------- it's so manual
        o.sheets("sheet1").range(strRange).value = ado_rs(Rscolumn)
        strRange = "B" & Row & ":B" & Row
        o.sheets("sheet1").range(strRange).value = ado_rs(Rscolumn + 1)
       Row = Row + 1
        ado_rs.MoveNext
      Wend
    End If


Reply With Quote
  #3  
Old December 19th, 2003, 08:55 AM
gjlinker gjlinker is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Manchester, UK
Posts: 23 gjlinker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You can use the SQL*XL addin for Excel to do this for you. SQL*XL is an end-user tool to get data from databases directly into your Excel spreadsheet. You can pick your table and download the data or supply a SQL query string.

Info on SQL*XL can be found at www.oraxcel.com

If you are looking for an automated solution you can use the SQL*XL API from within Excel. SQL*XL also supports macro recording so most of the code can be generated for you. By using VBA and SQL*XL you hide all the ADO and Excel difficulties.

Gerrit-Jan Linker
www.oraxcel.com (SQL*XL)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Pass Oracle ADO data from VB6 to Excel


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT