需要紧急帮助无法在数据库资源管理器中找到存储过程 [英] Urgent Help required Could not find stored procedure but its there in Database Explorer

查看:81
本文介绍了需要紧急帮助无法在数据库资源管理器中找到存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cmd.ExecuteNonQuery();正在返回一个execption无法找到存储过程....但它在那里





cmd.ExecuteNonQuery(); is returning an execption Could not find stored procedure.... but It is there


#region AddBus
public int Addbus(BusinessObject.BusinessObject objbo)
{
    //Create Connection
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString());
    //Open the Connection
    con.Open();
    //pass the procedure
    SqlCommand cmd = new SqlCommand("proc_addbus",con);
    cmd.CommandType = CommandType.StoredProcedure;

    cmd.Parameters.AddWithValue("@svno",objbo.ServiceNo);
    cmd.Parameters.AddWithValue("@fromplace",objbo.FromPlace);
    cmd.Parameters.AddWithValue("@toplace",objbo.Toplace);
    cmd.Parameters.AddWithValue("@capacity",objbo.capacity);
    cmd.Parameters.AddWithValue("@arrtime",objbo.ArriTime);
    cmd.Parameters.AddWithValue("@depttime",objbo.DeptTime);
    cmd.Parameters.AddWithValue("@tname",objbo.TrevalAgnName);
    cmd.Parameters.AddWithValue("@bustype",objbo.BusType);
    int i = cmd.ExecuteNonQuery();
    return i;

}
#endregion

推荐答案

要检查的事项:

- 连接字符串是否指向正确的数据库

- 为连接定义的用户是否具有查看和执行的权限程序

- 是程序dbo或其他人的所有者。是否需要指定模式

- 数据库区分大小写,是正确提供的过程名称的大小。
Things to check:
- does the connection string point to correct database
- does the user defined for the connection have privileges to view and execute the procedure
- is the owner of the procedure dbo or someone else. Do you need to specify the schema
- is the database case sensitive and is the casing of the procedure name provided correctly.


这篇关于需要紧急帮助无法在数据库资源管理器中找到存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆