Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Excel2000: Is it possible to run a pass-through query from Excel

Hi


I need to read some data from Sybase database and create an Excel chart
based on this data.

I can create a pass-through query in Access, but I don't like Access chart
designer, and I prefer Excel to create charts, when possible. Having the
query in Access and chart in Excel will be somewhat cumbersome. Is there a
way to run a Sybase pass-through query from Excel (probably from some
procedure), and how to do it? (I have a Data Source for connection to Sybase
database - let it be MySource - defined on my computer, and I can get a
working SQL-string from my Access test application)


Thanks in advance

--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Excel2000: Is it possible to run a pass-through query from Excel

Simple using ADO.

Sub GetData()
Const adOpenForwardOnly As Long = 0
Const adLockReadOnly As Long = 1
Const adCmdText As Long = 1
Dim oRS As Object
Dim sConnect As String
Dim sSQL As String
Dim ary

sConnect = "Provider=Sybase.ASEOLEDBProvider;" & _
"Srvr=myASEServer,5000;" & _
"Catalog=myDBName;" & _
"User Id=myUserName;" & _
"Password=myUserPassword"

sSQL = "SELECT * From TableName"
Set oRS = CreateObject("ADODB.Recordset")
oRS.Open sSQL, sConnect, adOpenForwardOnly, _
adLockReadOnly, adCmdText

' Check to make sure we received data.
Worksheets("Sheet1").Range("A1").CopyFromRecordset oRS

oRS.Close
Set oRS = Nothing
End Sub

But see
http://www.carlprothman.net/Default....rverEnterprise
for some notes.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Arvi Laanemets" wrote in message
...
Hi


I need to read some data from Sybase database and create an Excel chart
based on this data.

I can create a pass-through query in Access, but I don't like Access chart
designer, and I prefer Excel to create charts, when possible. Having the
query in Access and chart in Excel will be somewhat cumbersome. Is there a
way to run a Sybase pass-through query from Excel (probably from some
procedure), and how to do it? (I have a Data Source for connection to
Sybase database - let it be MySource - defined on my computer, and I can
get a working SQL-string from my Access test application)


Thanks in advance

--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Excel2000: Is it possible to run a pass-through query from Excel

Hi

Thanks!

I think I have to try to modify your code somehow, so I can use a
pass-through there.

1. I have checked before, and found, that average simple Access/Excel query
(Select * from Table) from most tables in our Sybase database takes about 20
minutes, and only seconds from Sybase Anywhere.
2. It isn't very good idea to meddle with MS query in any critical database,
when there are 100 - 200 users connected to it.
3. The original (Sybase) query uses some functions not available in Access
or Excel. Replacing them is probably possible, but may cause additional
problems.
4. The query uses 4 Left Outer Join's (1 join + 3 join's sequently) + 4 Left
Outer Join's in second part (it is an Union query). Unless I missed
something, in Excel2000 only 2 tables can be connected using outer join's.


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )



"Bob Phillips" wrote in message
...
Simple using ADO.

Sub GetData()
Const adOpenForwardOnly As Long = 0
Const adLockReadOnly As Long = 1
Const adCmdText As Long = 1
Dim oRS As Object
Dim sConnect As String
Dim sSQL As String
Dim ary

sConnect = "Provider=Sybase.ASEOLEDBProvider;" & _
"Srvr=myASEServer,5000;" & _
"Catalog=myDBName;" & _
"User Id=myUserName;" & _
"Password=myUserPassword"

sSQL = "SELECT * From TableName"
Set oRS = CreateObject("ADODB.Recordset")
oRS.Open sSQL, sConnect, adOpenForwardOnly, _
adLockReadOnly, adCmdText

' Check to make sure we received data.
Worksheets("Sheet1").Range("A1").CopyFromRecordset oRS

oRS.Close
Set oRS = Nothing
End Sub

But see
http://www.carlprothman.net/Default....rverEnterprise
for some notes.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Excel2000: Is it possible to run a pass-through query from Excel

None of that seems relevant to me. You are using ADO to pass a command to
the database, not MSQuery, so it is what the database can do that is
relevant. The joins etc. are all handled by the DB engine. Excel doesn't
come into it, Access is totally irrelevant.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Arvi Laanemets" wrote in message
...
Hi

Thanks!

I think I have to try to modify your code somehow, so I can use a
pass-through there.

1. I have checked before, and found, that average simple Access/Excel
query (Select * from Table) from most tables in our Sybase database takes
about 20 minutes, and only seconds from Sybase Anywhere.
2. It isn't very good idea to meddle with MS query in any critical
database, when there are 100 - 200 users connected to it.
3. The original (Sybase) query uses some functions not available in Access
or Excel. Replacing them is probably possible, but may cause additional
problems.
4. The query uses 4 Left Outer Join's (1 join + 3 join's sequently) + 4
Left Outer Join's in second part (it is an Union query). Unless I missed
something, in Excel2000 only 2 tables can be connected using outer join's.


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )



"Bob Phillips" wrote in message
...
Simple using ADO.

Sub GetData()
Const adOpenForwardOnly As Long = 0
Const adLockReadOnly As Long = 1
Const adCmdText As Long = 1
Dim oRS As Object
Dim sConnect As String
Dim sSQL As String
Dim ary

sConnect = "Provider=Sybase.ASEOLEDBProvider;" & _
"Srvr=myASEServer,5000;" & _
"Catalog=myDBName;" & _
"User Id=myUserName;" & _
"Password=myUserPassword"

sSQL = "SELECT * From TableName"
Set oRS = CreateObject("ADODB.Recordset")
oRS.Open sSQL, sConnect, adOpenForwardOnly, _
adLockReadOnly, adCmdText

' Check to make sure we received data.
Worksheets("Sheet1").Range("A1").CopyFromRecordset oRS

oRS.Close
Set oRS = Nothing
End Sub

But see
http://www.carlprothman.net/Default....rverEnterprise
for some notes.





Reply
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
pass an excel cell value to a web query ed Excel Programming 2 November 29th 05 04:52 PM
Pass parametres from Excel to Access query Andrew[_50_] Excel Programming 2 September 12th 05 04:46 PM
Is there a way to pass parameters to a web query in excel daytonsupply Excel Programming 1 February 23rd 05 04:10 PM
How to pass a date in Excel to ms query Vince Excel Programming 0 June 16th 04 10:08 PM
How to pass a date in Excel to ms query Tom Ogilvy Excel Programming 0 June 16th 04 04:26 PM


All times are GMT +1. The time now is 01:40 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"