Jump to content
  • Advertisement
Sign in to follow this  
shvalb

How do I use the SQLConnect() ??

This topic is 4883 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!