Solved

ODBC Datasource 'Picker'

Posted on 2001-08-30
17
381 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ClickOnce Install - Shortcut Question 3 72
Problem to file 3 67
WPF issue with Trigger 2 96
Interview questions for support of a legacy ASP.NET site 4 39
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now