简体   繁体   中英

What database module in VB.net will allow me to connect to both SQL Server and a MDF file?

Do you know which module in VB.net will allow me to connect to a file ( mdf/mdb ) and SQL Server (not at the same time but to change in runtime).

Or do you know of two modules which have the same API?

I'm building software which I will wont work both locally and on a server. But I don't want to have to go changing all of my code just because I'm using a different modules. I know VB.net, but I've never used databases.

There's so many different database connectors its confusing!

Thank you, answers and comments are much appreciated!

The System.Data namespace provides base classes that can work against any supported data source via ADO. You could connect to both SQL and MDB with the OleDb provider, but it would be much faster if you used the native SqlClient provider when accessing SQL Server. You may find the DbProviderFactories class very helpful:

http://msdn.microsoft.com/en-us/library/dd0w4a2z.aspx

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