English 中文(简体)
如果需要一个附有表格的数据库,如何部署我的申请?
原标题:How to deploy my application if it requires a database with tables created?

我以前曾使用SQL服务器 CE的数据库。 这种简便,因为我可以有一个简单的<代码>.sdf文档的数据库,并用我的应用程序(或是空洞的或已经添加的数据)加以部署。

But what if I want to change the database to a SQL Server Express one?

当然,如果我的客户已经拥有数据库,我就不必修改任何内容(例如string)。

www.un.org/Depts/DGACM/index_spanish.htm 如果我想要向需要建立当地服务器快车数据库的客户提出申请,那么我应当做些什么? 是否有办法使用mdf文档这样做?

当然,如果有必要的话,我有SQL代码,以编制所有表格,并附有相应的外国钥匙。

我相信,这是很多发展者所面对的,但我不知道如何做到这一点。

请不要建议使用SQLite、MySQL或其他数据库。 我要问这个问题,因为我想知道如何在服务器上这样做。

最佳回答

你可以与所附的行文显示的快车道连接:

data source=.SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true

你们也可以支持你的工作,然后在部署时恢复工作。

UPDATE But if you don t want to copy data, only structure, I suggest that you should go on with SQL scripts. You can check if the DB exists and create it if it is not. You can even init some tables with bulk inserts.

if db_id( dbname ) is null BEGIN CREATE DATABASE ... etc

根据您的申请类型,你可以说明贵国的部署说明(AFAIK, VS2010为网络应用提供这种说明),也可以把你的文字作为部署步骤。

问题回答

There are several things to think about:

  1. You might need to redistribute SQL Express itself
  2. Deploy the database to a fresh setup
  3. 将现有数据库移至新的图谋/转化

    Add 1.

    Add 2. On the MSDN

    添加3. 我用于解决这一问题的唯一两种方式是:部署新版本,用文字转换数据;2)制作文字,将目前版本改为新版本。

根据我的经验,迁移现有的数据库可能证明是最难做的事,这取决于对数据库图示的改动。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签