打开Microsoft.practices.EnterpriseLibrary数据库只有一个连接字符串 [英] Open Microsoft.practices.EnterpriseLibrary database with just a connection string

查看:540
本文介绍了打开Microsoft.practices.EnterpriseLibrary数据库只有一个连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Microsoft.Practices.EnterpriseLibrary数据库工具,我无法使用连接字符串信息创建新数据库。



理想情况下,我想执行以下操作:

 数据库dbEngine = DatabaseFactory.CreateDatabase(
= myServerAddress; Initial Catalog = myDataBase; Integrated Security = SSPI;);

是否可以使用连接字符串创建数据库?



如果是,如何实现?

解决方案

b
$ b

  
数据库mydb = new EnterpriseLibrary.Data.Sql.SqlDatabase(connection string here);

,您将保留Database对象的多功能性,但使用连接字符串创建。 / p>

I am using the Microsoft.Practices.EnterpriseLibrary Database tools and I'm having trouble creating a new database using just the connection string information.

Ideally I would like to do the following:

Database dbEngine = DatabaseFactory.CreateDatabase(
    "Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;");

Is it possible to create a database using just the connection string?

If so, how can it be achieved?

解决方案

You can also do


Database mydb = new EnterpriseLibrary.Data.Sql.SqlDatabase("connection string here");

and you'll retain the versatility of the Database object, but create it with a connection string.

这篇关于打开Microsoft.practices.EnterpriseLibrary数据库只有一个连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆