I have a small application based on WINAPI from which I need to connect to MS SQL Server 2008 R2 through ODBC.
I had created the needed DSN and configured it. Its testing was successful.
However, when it came to my code, things are not working. I am calling SQLConnect function and getting the below error:
1 2 3 4
"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
It looks to me like you had a problem calling the function, mislabeled your DSN or something like that. Without seeing any code I don't think anyone here can help that much.
A likely possibility (again without seeing any code I don't really know) is that you simply messed up one of the parameters in the SQLConnect function. The function as I'm sure you know is supposed to be:
But if you put in for example: Servername
instead of: SERVERNAME
It would give you trouble due to case sensitivity. I'm not going to list other possible mistakes in calling the function but start there because if your DSN is functioning normally in every regard except for this function call then I would have to assume the problem is in the function call.
slambert: thx for your update.
I fixed the problem. It took me several hours. The problem was in the data conversion from char * to SQLWCHAR *.
I initiated the values to char * variables, then I converted those variable to wchar_t * that is equivalent to SQLWCHAR*.
Anyway, thanks again for you since you were the only who replied ;)