Solved

Connect to Sybase from Excel

Posted on 2002-07-15
6
660 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel 2010 question 3 54
MS Word Formatting 3 47
Office2007 Training Material Required 2 41
converting visio 2010 to powerpoint 2010  - formatting issues 5 11
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

919 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

19 Experts available now in Live!

Get 1:1 Help Now