且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

system.data.dll中发生了'system.data.sqlclient.sqlexception'类型的异常,但未在用户代码中处理其他信息:找不到存储过程'spconti'。

更新时间:2023-02-24 18:56:46

您好,



尝试更改以下代码。



Hi,

Try changing your code like the following.

private DataSet GetData(string SPname, SqlParameter SPParameter)
      {
          	string CS = ConfigurationManager.ConnectionStrings["SampleDemoConnectionString"].ConnectionString;
          	SqlConnection conn = new SqlConnection(CS);


                SqlCommand cmd = new SqlCommand("SPname", conn);
		if (SPParameter!=null)
          	{
              		cmd.Parameters.Add(SPParameter);
          	}
                
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = cmd;
                
 
          	DataSet DS = new DataSet();
          	da.Fill(DS);
          	return DS;
      }





在此之前,请确保您的sp存在于数据库中。



谢谢,

Sisir Patro



Prior to this make sure that your sp exists in the database.

Thanks,
Sisir Patro