English 中文(简体)
ASP 多个应急数据库。 NET MVC申请
原标题:Managing multiple customer databases in ASP.NET MVC application

我正在建立一个应用程序,要求每个客户建立单独的服务器数据库。

为此,我需要能够建立一个新的客户文件夹,把原型数据库的复印件放在文件夹中,改变数据库的名称,并将数据库作为服务器的新“数据库实例”。 原型数据库包含所有所需的表格、实地和指数定义,但没有数据记录。 我将利用SMO管理数据库的配送、贴出和重新命名。

在建立原型数据库的过程中,我尝试使用Sql服务器管理演播室,将数据库的副本(companion .MDF, .LDF pair)附在服务器上,并发现SSMS期望数据库在服务器上居住。

c:program filesMicrosoft SQL ServerMSSQL.1MSSQLDATAMyDatabaseName.MDF

服务器的“名称”吗? 是否有办法在单独的名录中管理个别数据库? 或者,我是否必须把所有客户数据库放在同一个目录中? (我希望得到比这更好的控制。)

NOTE:我目前使用的是LQ服务器快车,但仅用于测试。 制作数据库将为2008年服务器,企业版。 因此,“证人”并非一种选择。

问题回答

国防部在其表格中载有所有数据库档案的物理途径,因为它们正在脱离数据库。 在附属作业期间,你可以超越地点:

CREATE DATABASE <dbname>
 ON (name=dbfilelogicalname, filename= c:myNewPathdbfilename.mdf ),
 (name=dbfile2logicalname, filename= c:myNewPathdbfilename2.ndf ),
 (name=dbloglogicalname, filename= c:myNewPathdblogfilename.ldf )
 FOR ATTACH;




相关问题
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. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签