【发布时间】:2016-02-10 13:47:47
【问题描述】:
我正在 Visual Studio 2012 中处理一个项目。最近,我在解决方案中添加了一个数据库项目。在我将数据库添加到解决方案之前,该数据库已经存在并且一切正常。 但是,现在,当我尝试运行应用程序时出现错误。这些错误是由名为 [database name].sql 的计算机生成文件引起的。在图块的顶部,写着:
/*
Deployment script for [the database name here]
This code was generated by a tool.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
*/
每次应用程序运行时都会重新创建此文件。发生的错误似乎是语法错误。我无法修复它们,因为我对文件所做的任何更改都无关紧要,因为每次运行都会生成一个新文件并且错误会重新出现。
我尝试在网上进行更多调查,但遇到了麻烦。这对我来说都是新的。
以下是一些正在创建的错误:
GO
:setvar DatabaseName "(the database name is here)"
这给了我三个错误:
Error 88 SQL80001: Incorrect syntax near ':'.
Error 89 SQL80001: 'DatabaseName' is not a recognized option.
Error 90 SQL80001: Incorrect syntax near '"(the database name is here in the code)"'.
另外,还有一行代码如下:
CREATE USER [(the domain)\(the username)] FOR LOGIN [(the domain)\(the username)];
GO
这给出了以下错误:
Error 119 SQL72014: .Net SqlClient Data Provider: Msg 15401, Level 16, State 1, Line 1 Windows NT user or group '(the domain)\(the username)' not found. Check the name again.
【问题讨论】:
-
也许包括实际错误可能会有所帮助。 stackoverflow.com/help/how-to-ask
-
有什么错误?即使生成错误的代码不能直接更改,也将有另一种方法来确保生成的代码是正确的。
-
更新:包含错误
标签: sql database visual-studio stored-procedures deployment