Link to home
Start Free TrialLog in
Avatar of meverest
meverestFlag for Australia

asked on

ODBC Datasource 'Picker'

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.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany 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 jimwasson
jimwasson

Have you looked at CDataSource::Open( hwnd, flags)?  It can give you a dialog allowing you to select the data source and driver.
Avatar of meverest

ASKER

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.
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.
'sql.h' and odbc32.lib...
doesn't seem to be in sql.h...  i have downloaded the odbc dsk, looking if there are any clues in there...

cheers.
Sorry, I should take a look myself before posting, even when it's Sunday :o)

It's in odbcinst.h....
OK,

found it in odbcinst.h, nearly there.
heheh - too quick for me ;-)
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.

ok, yes...

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

regards.
>>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)
Hmm, anything new? :o)
Well, did it work?
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.
>>in the meantime, i will award this 'A'

Thank you!

(BTW: Did accepting an answer not work?)
you are right - i forgot to score it .... :-}

regards.