• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 403
  • Last Modified:

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.
0
meverest
Asked:
meverest
  • 9
  • 7
1 Solution
 
jkrCommented:
0
 
jimwassonCommented:
Have you looked at CDataSource::Open( hwnd, flags)?  It can give you a dialog allowing you to select the data source and driver.
0
 
meverestAuthor Commented:
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
Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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

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

It's in odbcinst.h....
0
 
meverestAuthor Commented:
OK,

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

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

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

Thank you!

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

regards.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now