Solved

ODBC Datasource 'Picker'

Posted on 2001-08-30
17
384 Views
Last Modified: 2013-12-03
Hi Folks,

is there something similar to CFileDialog that i can use to fire up the system ODBC manager and return a selected (new or existing) ODBC datasource?

thanks in advance for any suggestions!

regards,  Mike.
0
Comment
Question by:meverest
  • 9
  • 7
17 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
ID: 6444575
0
 
LVL 7

Expert Comment

by:jimwasson
ID: 6445775
Have you looked at CDataSource::Open( hwnd, flags)?  It can give you a dialog allowing you to select the data source and driver.
0
 
LVL 37

Author Comment

by:meverest
ID: 6446846
thanks folks,

i'll check them both out and get back soon.

please feel free to remind me if it looks like i have forgotten!

cheers.
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 37

Author Comment

by:meverest
ID: 6448597
Hello,

yes! SQLManageDataSources() looks like ot is exactly what i am looking for....  the problem now, is "where can i find the prototypes and what do i lionk to in order to access that code from my application?

many thanks.
0
 
LVL 86

Expert Comment

by:jkr
ID: 6449043
'sql.h' and odbc32.lib...
0
 
LVL 37

Author Comment

by:meverest
ID: 6449311
doesn't seem to be in sql.h...  i have downloaded the odbc dsk, looking if there are any clues in there...

cheers.
0
 
LVL 86

Expert Comment

by:jkr
ID: 6449314
Sorry, I should take a look myself before posting, even when it's Sunday :o)

It's in odbcinst.h....
0
 
LVL 37

Author Comment

by:meverest
ID: 6449327
OK,

found it in odbcinst.h, nearly there.
0
 
LVL 37

Author Comment

by:meverest
ID: 6449332
heheh - too quick for me ;-)
0
 
LVL 37

Author Comment

by:meverest
ID: 6449337
funny thing is...

it compiles and links all ok, but when i click the button:

void CQMCconfigDlg::OnChooseDSN()
{
    SQLManageDataSources( NULL );
}

nothing happens....  maybe i need something explicit for the CWnd argument?

regards.

0
 
LVL 37

Author Comment

by:meverest
ID: 6449398
ok, yes...

SQLManageDataSources is returning FALSE with invalid HWND - so where do i find a valid hwnd from my dialog-based app?

regards.
0
 
LVL 86

Expert Comment

by:jkr
ID: 6451078
>>so where do i find a valid hwnd from my
>>dialog-based app

Well, use the hadle of your dialog window - or, if you don't really care, get yourself a handle using 'GetDesktopWindow()' :o)
0
 
LVL 86

Expert Comment

by:jkr
ID: 6459314
Hmm, anything new? :o)
0
 
LVL 86

Expert Comment

by:jkr
ID: 6496436
Well, did it work?
0
 
LVL 37

Author Comment

by:meverest
ID: 6498547
thanks for the reminder, i have not yet completed this project - have been side-tracked for the moment, but will get back to it eventually.

in the meantime, i will award this 'A' because your response *does* answer my question specifically - even if i have not figured out how to use it yet! ;-)

i will post another question when i get back to this project.

regards.
0
 
LVL 86

Expert Comment

by:jkr
ID: 6498564
>>in the meantime, i will award this 'A'

Thank you!

(BTW: Did accepting an answer not work?)
0
 
LVL 37

Author Comment

by:meverest
ID: 6498587
you are right - i forgot to score it .... :-}

regards.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

772 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