Solved

Connect to Sybase from Excel

Posted on 2002-07-15
6
652 Views
Last Modified: 2008-03-04
Hi,

I need some example code to connect to Sybase from Excel 97 or 2000 and make some simple queries.  I know SQL so there is no problem there and I used to program in VB 4 but those days were more DAO than ADO.  However from what I can find ADO is better for Sybase.  I found this code:

Dim ad as ADODB.Connection

set ad=New ADODB.Connection
Let ad.ConnectionString= "ODBC;DSN=" & DatabaseName & ";UID=" &
UserName & ";PWD=" & UserPassword
ad.Open

But I get an error at Dim ad... as if the ADODB object is not installed or not accesable from VBA.  The for the Sybase part I found this:

"Last, but not least in my mind and definitely no performance slouch is to use the ODBC driver but bypass ADO's default mechanism for connecting to ODBC drivers. Basically if you connect with standard syntax ODBC syntax, like: "Driver={Sybase System 11};PWD=vbguru;UID=gelbro;DB=dictionary;servername=SYBPRD_DEV" and so on, you'll be speeding along. "

at http://www.vbrad.com/pf.asp?p=Source/tip_Sybase_vb.htm

In the section on Sybase 11.x, Im using 11.033.

If some one can throw these togeather and help me make it work I would appreciate it.  Do I maybe need to have VB installed?  I want this XLS to be distributable (See My Question:  Batch Reports With Dynamic Charts? )

Thanks for the help.

0
Comment
Question by:guadalupe
  • 3
  • 2
6 Comments
 
LVL 12

Expert Comment

by:James Elliott
Comment Utility
It sounds like you know what your talking about so excuse this response if you have already thought of it!!!

Have you ticked your ADO references in the VB editor??

Goto tools/references and tick the ADO library.

Thanks

Jell
0
 
LVL 3

Author Comment

by:guadalupe
Comment Utility
No problem jell, and the response is actually yes and no.  I went to check the reference but the only one I found which related to ADO was: Microsoft ADO Ext. 2.5 for DDL and Security

Didn't seem like what I wanted but yes I had it checked anyway and I still got the error above.  I donde have just a plain ADO Lib.  Should it be there?

Thanks...
0
 
LVL 12

Expert Comment

by:James Elliott
Comment Utility
I've just had a look into some of the projects that I've done and I think if you check the 'OLE Automation' reference then that should install the ADO library.

Thanks

Jell
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 3

Author Comment

by:guadalupe
Comment Utility
OLE Automation is checked, but thanks for the suggestion!
0
 
LVL 1

Accepted Solution

by:
tommybak earned 500 total points
Comment Utility
In references look for Microsoft ActiveX Data Object 2,5 library.
regards Tommy
0
 
LVL 3

Author Comment

by:guadalupe
Comment Utility
That did it, thank you. Jell, think I was a little slow on the uptake.  If you need points, tell me and I'll repost to give you your cred!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction Perhaps more familiar to developers who primarily use VBScript than to developers who tend to work only with Microsoft Office and Visual Basic for Applications (VBA), the Dictionary is a powerful and versatile class, and is useful …
In case Office 2010 has not been deployed in your environment, this article may be quite useful. In our office, we wanted a way to deploy Microsoft Office Professional Plus 2010 through an automated batch file via logon script. This article is docum…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now