【发布时间】:2015-02-10 03:53:30
【问题描述】:
当我尝试获取 URL 并将其传递给过程时 它没有通过
string ID = Request.QueryString["URL"];
youtube y = new youtube();
y.URL = ID;
repCurrentVideo.DataSource = y.CurrentVideo();
repCurrentVideo.DataBind();
lblDetails.Text = "no details available about this video";
显示给我的错误说 过程或函数“currentvideo”需要参数“@URL”,但未提供该参数。 异常详细信息:System.Data.SqlClient.SqlException:过程或函数“currentvideo”需要参数“@URL”,但未提供。
这是存储过程调用代码
public DataTable CurrentVideo()
{
CreateConnection();
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@URL", URL);
SqlDataAdapter da = new SqlDataAdapter("currentvideo", conn);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
【问题讨论】:
-
您的请求是什么样的?
标签: c# asp.net stored-procedures