Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ODBC entry

Posted on 1999-06-30
15
Medium Priority
?
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

721 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