0

I want to connect my VB project to Whatever server is on the same computer. I want to then interrogate it for the database names. SELECT name FROM sys.databases Drop those database names in a drop down. Then change the connection based on the drop down selection. Is this possible?

Should I use ODBC or the SQL DataSource?

1
  • is whatever server is on the computer a sql server Jun 6, 2013 at 16:00

1 Answer 1

0

Well from what I quickly searched you would use SQL DataSource to connect to an ODBC Database. No matter, you should always be able to give your users the control to select a database table name and then return them all the data you want from that table. This can be done with either a nice switch statement as to not trust what the user submits in the form or well actually yeah you should use a switch statement because NEVER TRUST USER INPUT. You could get a little fancy and create a dynamic switch statement generated from a query to the DB of what tables appear in the DB and then add whatever code you need to get the return.

Hope that is a point in the correct direction for you.

EDIT switch out table names for Database names, same concept though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.