Visual Studio Server资源管理器是否支持自定义数据库提供程序?

时间:2020-03-05 18:44:17  来源:igfitidea点击:

在我的一些学习项目中,我曾使用Server Explorer和相关工具与Microsoft SQL Server进行图形数据库开发,这是一次很棒的经历。但是,在我的工作中,我处理Oracle DB和SQLite,我的业余项目使用MySQL(因为它们托管在Linux上)。

有没有一种方法可以将Visual Studio中与数据库相关的工具与其他数据库提供程序一起使用?

解决方案

回答

服务器资源管理器应支持任何提供ODBC驱动程序的数据库系统。对于Oracle,Visual Studio有一个内置驱动程序。

在"添加连接"对话框中,单击数据源上的"更改"按钮,然后应获取我们具有驱动程序的提供程序的列表。

回答

这是有关如何从Visual Studio连接到MySQL数据库的说明:

To make the connection in server
  explorer you need to do the following:
  
  
  first of all you need to install the MyODBC connector 3.51 (or latest) on
  the development machine (NB. you can
  find this at
  http://www.mysql.com/products/connector/odbc/
  )
  Create a datasource in Control Panel/Administrative Tools with a
  connection to your database. This data
  source is going to be used purely for
  Server Manager and you dont need to
  worry about creating the same data
  source on your clients PC when you
  have made your VS.NET application
  (Unless you want to) - I dont want to
  cover this in this answer, too long.
  For the purpose of this explanation I
  will pretend that you created a MyODBC
  data source called 'AADSN' to database
  'noddy' on mysqlserver 'SERVER01' and
  have a root password of 'fred'. The
  server can be either the Computer Name
  (found in Control
  Panel/System/Computer Name), or
  alternatively it can be the IP
  Address. NB. Make sure that you test
  this connection before continuing with
  this explanation.
  open your VS.NET project
  go to server explorer
  right-click on 'Data Connections'
  select 'Add Connection'
  In DataLink Properties, go to the provider tab and select "Microsoft OLE
  DB Provider For ODBC drivers"
  Click Next
  If you previously created an ODBC data source then you could just select
  that. The disadvantage of this is that
  when you install your project
  application on the client machine, the
  same data source needs to be there. I
  prefer to use a connection string.
  This should look something like:
  
  
  DSN=AADSN;DESC=MySQL ODBC 3.51 Driver
  DSN;DATABASE=noddy;SERVER=SERVER01;UID=root;PASSWORD=fred;PORT=3306;SOCKET=;OPTION=11;STMT=;
  
  If you omit the password from the
  connection string then you must make
  sure that the datasource you created
  (AADSN) contains a password. I am not
  going to describe what these mean, you
  can look in the documentation for
  myodbc for that, just ensure that you
  get a "Connection Succeeded" message
  when you test the datasource.

回答

我在研究Sqlite的过程中发现了这一点。我还没有机会使用它。让我们知道这是否适合我们。

http://sqlite.phxsoftware.com/

System.Data.SQLite   System.Data.SQLite is the original
  SQLite database engine and a complete
  ADO.NET 2.0 provider all rolled into a
  single mixed mode assembly.  
  
  ...  
  
  Visual Studio 2005/2008 Design-Time
  Support  
  
  You can add a SQLite connection to the
  Server Explorer, create queries with
  the query designer, drag-and-drop
  tables onto a Typed DataSet and more!  
  
  SQLite's designer works on full
  editions of Visual Studio 2005/2008,
  including VS2005 Express Editions.  
  
  NEW You can create/edit views, tables, indexes, foreign keys,
  constraints and triggers interactively
  within the Visual Studio Server
  Explorer!

回答

@Espo:答案非常好,在VS Professional中效果很好。这也适用于Express版本吗?我已在装有VS 2005 Pro和VS 2008 Express的计算机上安装了MySQL ODBC驱动程序,只有VS Pro将ODBC数据源显示为可用选项。

@hitec:这表明我的情况是MySQL ODBC安装程序中的错误。

回答

Oracle有一套与Visual Studio集成的工具。它与他们的数据访问库打包在一起。

http://www.oracle.com/technology/software/tech/windows/odpnet/index.html