?
Solved

ODBC entry

Posted on 1999-06-30
15
Medium Priority
?
322 Views
Last Modified: 2010-04-16
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
0
Comment
Question by:kavint
  • 5
  • 4
  • 3
  • +2
15 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 800 total points
ID: 1198866
I am not sure if I understand your question correctly. Take a look at the following MFC technical note.

TN048: Writing ODBC Setup and Administration Programs for MFC Database Applications
http://msdn.microsoft.com/library/devprods/vs6/vc++/vcmfc/_mfcnotes_tn048.htm
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1198867
If I understand correctly, you can use SQLCreateDataSource for that, just pass the DSN as the second argument

0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1198868
DSN go  in the registry:
User DSN
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\
System DSN
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LVL 2

Author Comment

by:kavint
ID: 1198869
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.
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1198870
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.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1198871
It's declared in ODBCINST.H
SqlCreateDataSource(hMyWnd, "MyDSN");
0
 
LVL 2

Author Comment

by:kavint
ID: 1198872
MikeP,
Thanks for your response. I'll try it out.
0
 
LVL 2

Author Comment

by:kavint
ID: 1198873
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
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1198874
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.
0
 
LVL 2

Author Comment

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

0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1198876
In such situations, post a question in Customers section asking them to reassign points to KingaPoo
0
 
LVL 2

Author Comment

by:kavint
ID: 1198877
Thanks for the suggestion. I'll do that.
0
 
LVL 3

Expert Comment

by:darinw
ID: 1198878
Reviewing question.
 
darinw
darin@experts-exchange.com

0
 
LVL 3

Expert Comment

by:darinw
ID: 1198879
KangaRoo, please post an answer to this question:

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

0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 1198880
I have and thanks for the effort :)
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question