简体   繁体   中英

ODBC or SQL DataSource?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM