我尝试添加自定义分页,当我通过用户名和密码登录时,出现错误。
此外,我只显示他/她的文档,例如当 abc 登录时,abc 只能查看她的文档,但是当我添加自定义分页时,它显示UserID
未提供错误,我还共享 sp 代码
代码是
protected void BindRepeater()
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["mydms"].
ConnectionString.ToString());
SqlCommand cmd = new SqlCommand("sphrdoc2", con);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
DataTable dt = new DataTable();
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(dt);
PagedDataSource pgitems = new PagedDataSource();
DataView dv = new DataView(dt);
在这一行
adp.Fill(dt);
发生错误
过程或函数“sphrdoc2”需要参数“@UserID”,但未提供该参数。
sp 是
ALTER procedure [dbo].[sphrdoc2]
@UserID int
as
Select
dbo.DocumentInfo.DocID as DocumentID,
dbo.DocumentInfo.DocName as DocumentName,
dbo.DocType.DocType as Document,
dbo.Department.DepType as Department,
dbo.DocumentInfo.Uploadfile as FileUploaded,
dbo.ApproveType.ApproveType AS Status
FROM
dbo.DocumentInfo
inner JOIN dbo.DocType ON dbo.DocumentInfo.DocTypeID=dbo.DocType.DocTypeID
inner JOIN dbo.Department ON dbo.DocumentInfo.DepID=dbo.Department.DepID
left join dbo.ApproveType on dbo.DocumentInfo.ApproveID=dbo.ApproveType.ApproveID
where UserID=@UserID
有人告诉我我在转发器代码中做错了什么吗?