使用DataContext.CreateDatabase在SQL Azure中 [英] Use DataContext.CreateDatabase in SQL Azure
问题描述
我试图重新部署我在几个不同的环境下ASP.NET MVC3应用程序,并想使用SQL Azure的尝试。我想用我现有的LINQ结构和CreateDatabase用于创建这些数据库。
I am trying to re-deploy my ASP.NET MVC3 application across several different environments and would like to try using SQL Azure. I'd like to use my existing LINQ structure and CreateDatabase to create these databases.
我不知道我该如何使用的CreateDatabase使用SQL Azure的的因为使用的语句没有在平台上工作。
I am wondering how I can use CreateDatabase with SQL Azure since the USE statement doesn't work on the platform.
请与任何建议或答案,如果有可能是一个更好的方式来做到这一点。
Please answer with any suggestions or if there might be a better way to do this.
推荐答案
HTTP: //msdn.microsoft.com/en-us/library/ee336274.aspx
重要提示:创建数据库
语句必须是唯一的声明
在Transact-SQL批处理。你一定是
连接到主数据库时
执行CREATE DATABASE
声明。
Important: The CREATE DATABASE statement must be the only statement in a Transact-SQL batch. You must be connected to the master database when executing the CREATE DATABASE statement.
你必须找到一种方法,适合在这个premise。也许这是不可能的。
You'll have to find a way to fit in this premise. Maybe it's not possible.
这篇关于使用DataContext.CreateDatabase在SQL Azure中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!