2011-02-27 45 views
0

嗨 我不知道如何定义我的问题,但让我试试: 我已经开发了Visual Studio .NET 2010上的ASP.NET 4.0应用程序。然后我将它部署在Windows XP上。该应用程序使用SQL Server 2008中的数据库。SQL Server 2008已经安装在Windows XP上。我从我的应用程序中附加了数据库,为db创建了一个用户,并在web配置中使用了以下connectionString。SQL Server 2008 ASP.NET 4.0应用程序的奇怪行为

connectionString="Data Source=PC-Name;Initial Catalog=DataBaseName;User Id=username;Password=password;" 

应用程序现在的工作,即它是查询数据库,但是当我尝试插入操作它提供了以下错误:

> Server Error in '/' Application. 
-------------------------------------------------------------------------------- 

A network-related or instance-specific error occurred while establishing a 
connection to SQL Server. The server was not found or was not accessible. 
Verify that the instance name is correct and that SQL Server is configured to 
allow remote connections. 
(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 
Description: An unhandled exception occurred during the execution of 
the current web request. 
Please review the stack trace for more information about the error 
and where it originated in the code. 
+1

也许用户'用户名'有SELECT权限但没有INSERT或UPDATE权限? – 2011-02-27 10:51:13

+0

你在目标系统上使用MSSQL 2008 Express版本吗? – Filburt 2011-02-27 11:07:08

回答

4

你确定你使用的是相同的ConnectionString对于插入操作?

+0

Bingo ....选择操作使用了我更新的web.config中的连接字符串。但是select操作使用了写在我没有更新的文件中的connectionString。谢谢。 – 2011-02-27 11:06:12