在服务器上传我的项目后,Sql Server无法找到存储过程...为什么......?

问题描述:

嗨..朋友...



在我的网络应用程序中,我使用的是sql server-2008 R2。我的Web应用程序在本地主机上正常运行,但是当我在服务器上上传我的项目时,它会出现错误,如......服务器无法找到存储过程'procedure_name'....



我用我在localhost上使用的相同名称以及不同的DB名称成功创建了我的数据库备份...我已经尝试过逐个使用这两个数据库,但仍然错误不是已解决....请帮帮我..



webConfig,DAL文件和Class文件中的连接字符串相同......



谢谢



Sunil sharma

Hi..friends...

In my web application i am using sql server-2008 R2. My web application runs fine at local host but when i uploaded my project on server then it's give an error like...."Server couldn't find store procedure 'procedure_name'...."

I have created backup of my DB successfully with the same name which i used at localhost as well as a different DB name...i have tried with both of DB one by one but still error is not resolved....Please help me..

My connection strings in webConfig, DAL file and Class file are same...

Thanks

Sunil sharma

直接使用生产服务器检查SSMS并查看数据库以检查您是否已传输存储过程 - 如果在执行备份以转移到生产服务器时未明确选择它们,则不会将它们复制到服务器。



您还可以使用此处的代码进行检查:使用C#枚举MS SQL Server 2000中的存储过程 [ ^ ] - 它已经过时了,但是应该仍然可以。
Check the production server directly using SSMS and look at the database to check that you transferred the stored procedures - if you didn't explicitly select them when you did the backup to transfer to the production server, then you will not have copied them to the server.

You can also check using code from here: Using C# to Enumerate Through Stored Procedures in MS SQL Server 2000[^] - it's old, but should still work.


右键单击localhost上的数据库。转到任务/生成脚本。在这里你可以创建脚本来创建你的所有过程,所以你可以在你的服务器上安装它们。
right click on your DB on localhost. Go to tasks/generate scripts. Here you can create scripts to create all of your procs, so you can install them on your server.


你好,



我建议从服务器删除数据库并创建一个空数据库,然后转到localhost右键单击数据库名称 - >任务 - >生成脚本,这里是捕获。



当你看到窗口选择对象你有两个选择

1.脚本整个数据库和数据库对象。

2.选择特定数据库对象



选择第二个选项并检查所有表和存储过程并创建脚本然后运行它到Sever数据库。它会工作正常。





这是因为当您选择First选项时,脚本是使用本地系统的MDF和LDF文件创建的路径,可能不存在于您的服务器中,并且脚本失败。





希望以上帮助。
Hi,

I will suggest that Delete your Database from Server and create an empty Database, after that go to localhost Right Click on DB Name -> Task -> Generate Script and here is the catch.

When you see the window Choose Objects You get two options
1. Script entire Database and database objects.
2. Select Specific database objects

Choose 2nd Option and Check all you tables and Stored Procedures and Create the script and then run it to Sever Database. It will Work Fine.


This is because When you choose First option the script is created with MDF and LDF file with your local systems path, which may not exists in your Server and the scripts fails.


Hope above helps.