Solved

Connect to Sybase from Excel

Posted on 2002-07-15
6
678 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 12

Expert Comment

by:James Elliott
ID: 7156520
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
ID: 7157751
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
ID: 7158875
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

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

Accepted Solution

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

Author Comment

by:guadalupe
ID: 7170135
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

749 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