Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select ODBC connection

Status
Not open for further replies.

howardnl

Programmer
Apr 12, 2001
18
0
0
US
Hello,

I'm working on an application where I want the user to be able to select a ODBC data source. How can I bring up the "Select Data Source" window? It looks similar to the ODBC Data Source Administrator window. In C++ I could do this like this:

CDatabase myDb;
myDb.Open(NULL, FALSE, FALSE, _T("ODBC;"), FALSE);

Eventually SQLDriverConnect is called which opens the "Select Data Source" window. I don't know if I'm not searching for the correct stuff, but I haven't been able to find much on how to do it C#. Could someone give me a push in the right direction?

Thank you very much for any help, I really appreciate it.

Thanks,
Nick

 
If you're using ADO.Net, I don't believe it will allow you to use an ODBC connection. If you're using old ADO, you would probably have to browse to the path where the DSN files are contained and list them yourself in a list box or something and let the user pick from that.
 
Thanks for the help RiverGuy. What if I'm using ODBC .NET?
 
My bad then, I forgot about that. I seem to forget because its not part of the regular .Net install. You had to download it, right? I haven't messed with it. Sorry about the confusion.
 
I had to download it. I don't know too much about it. I figured that since it can be done in C++ then it should also be able to be done in C#. We have a couple of support calls to Microsoft, so I might call them and see what they say.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top