Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm creating Win32 DLL project in VS 2015.

Using the following code:
C++
hr = pConnection->Open("Server=tcp:xxx.cloudapp.azure.com;Database=db_name;User ID=user_name;Password=psw;Trusted_Connection=False;Encrypt=False;", "", "", adConnectUnspecified);


Is it a correct code? The thing is that it don't work :(

What I have tried:

Checked SQL Server logs - no any authorization errors.
This is DLL, I don't really know how to debug it. Actually I can't debug it. So I don't know what my error exactly. I just know it stops after the string above.
Posted
Updated 27-Jun-17 9:21am
Comments
Richard MacCutchan 27-Jun-17 9:00am    
Without some debug information it is difficult to guess what is wrong. Since you created the DLL and you know where it stops you should be able to easily debug it.
Member 13277231 27-Jun-17 9:09am    
I don't know but I cannot attach the calling application...
The dll returns just retcode (int). How do I get retcode of the error? I found some examples of erros processing with try/catch https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/execute-requery-and-clear-methods-example-vc
But it's using printf... How can I do the same but with the error code?
Richard MacCutchan 27-Jun-17 10:21am    
Surely if it is your code you can look at the part that returns an error code and find out what is going on. No one here can guess what your code does.
ZurdoDev 27-Jun-17 9:27am    
https://www.connectionstrings.com/sql-azure/
Member 13277231 27-Jun-17 10:05am    
which one should I use? The one which is for .Net?

1 solution

I think I managed to solve it by adding
Driver={SQL Server};
in the begining of the string:
C++
<pre>hr = pConnection->Open("Driver={SQL Server};Server=sql.servername.com;Database=db_name;User ID=user_name;Password=psw;", "", "", adConnectUnspecified);


Thank you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900