更新时间: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
system.data.dll中发生了'system.data.sqlclient.sqlexception'类型的异常,但未在用户代码中处理其他信息:找不到存储过程'spconti'。
System.Data.dll中发生类型为'System.Data.SqlClient.SqlException'的异常,但未在用户代码中处理
eBayInventoryManagmentSystem.dll中发生了'System.NullReferenceException'类型的异常,但未在用户代码中处理
entityframework.sqlserver.dll中发生了'system.notsupportedexception'类型的异常,但未在用户代码中处理