Link to home
Start Free TrialLog in
Avatar of kavint
kavint

asked on

ODBC entry

Hi,
I have written a Windows Application that connects to a Microsoft Access Database. I am looking for a way to create an ODBC entry in the ODBC Administrator programatically.

I looked up the MFC set of APIs but didn't find any.

Can anyone help?

Thank in advance.
Kavitha
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MikeP090797
MikeP090797

If I understand correctly, you can use SQLCreateDataSource for that, just pass the DSN as the second argument

DSN go  in the registry:
User DSN
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\
System DSN
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\
Avatar of kavint

ASKER

chensu,MikeP
Thanks for the responses. I'm not clear how to use the function SQLCreateDataSource. I did a search on this function but didn't get any details regarding parameters, what DLL to include in the project etc.

If could provide more information on that, it would be helpful.

KangaRoo,
I am not sure what you mean by those registry entries. Could  you be a little elaborate?


Thanks a lot.
Start regedit and browse to the specified key. They contain DSN. Take a look.
SQLCreateDataSource starts a dialog with the user to create a new DSN.
It's declared in ODBCINST.H
SqlCreateDataSource(hMyWnd, "MyDSN");
Avatar of kavint

ASKER

MikeP,
Thanks for your response. I'll try it out.
Avatar of kavint

ASKER

KangaRoo,

I think I graded your answer and increased the points by 20. I'm not sure why it shows 20 instead of 220. Sorry about that. Your registry clue was very helpful.

Thanks
You graded the answer chensu gave :( why, he already has plenty of points ;)
After a question's answer is accepted other users can see the comments and answer only after 'paying' some points. The amount of points they have to pay is 1/10 of the original value (1/10 of 200 = 20), at least I think.
Avatar of kavint

ASKER

KangaRoo,
Oops! Sorry. I was confused. I've had people answer my questions before but never had this problem.

In such situations, post a question in Customers section asking them to reassign points to KingaPoo
Avatar of kavint

ASKER

Thanks for the suggestion. I'll do that.
Reviewing question.
 
darinw
darin@experts-exchange.com

KangaRoo, please post an answer to this question:

https://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=10177881 
 
darinw
darin@experts-exchange.com

I have and thanks for the effort :)