Sign in to follow this  

How do I use the SQLConnect() ??

This topic is 4667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I set a DSN and I called it myDSN and I try to connect like this : retVal = SQLAllocEnv(&henv); retVal = SQLAllocConnect(henv, &hdbc); retVal = SQLConnect(hdbc, (SQLCHAR*)"DSN=myDSN", SQL_NTS, (SQLCHAR*)"", SQL_NTS, (SQLCHAR*)"", SQL_NTS); and it fails on the SQLConnect, I get an error code of -1, what am I doing wrong ?

Share this post


Link to post
Share on other sites
Make sure to check the functions return value. If it returns SQL_ERROR, then get the associated SQLSTATE value with a call to SQLError. For a full list of values you could get back, go to this site:

http://odbcrouter.com/api/SQLConnect.shtml

It is the table under diagnostics.

This should tell you what is going wrong, and if you still can't go from there, then Ill try and help you.

Share this post


Link to post
Share on other sites

This topic is 4667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this