在C#中创建数据库实例 [英] Creating a database instance in C#
问题描述
是否可以使用C#代码创建sql数据库实例.我将数据库添加到现有SQL实例(例如WONEA \ SQLEXPRESS)没有问题,但是对于创建另一个SQL实例(例如WONEA \ SQLEXPRESSTEST),我有些困惑.救命!
Is it possible to create a sql database instance with C# code. I have no problem adding a database to an existing SQL instance, for example WONEA\SQLEXPRESS but for creating another SQL instance such as WONEA\SQLEXPRESSTEST I'm a little stumped. Help!
推荐答案
简短的答案是您无法使用C#代码来完成此操作.
The short answer is you can't do this using C# code.
SQL Server实例本质上是SQL Server的安装-为了创建一个新的SQL Server实例,您需要运行SQL Server安装程序,并要求它安装一个(从技术上讲,您可以从C#代码中进行安装,但是我收集了那不是您要找的答案).
SQL server instances are essentially installations of SQL server - in order to create a new SQL server instance you need to run the SQL Server installer, and ask it to install one (which you can technically do from C# code, but I gather thats not the answer you were looking for).
这篇关于在C#中创建数据库实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!