[英]DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'DocID'
i try this query to view documents only for those who uploaded through their account means user only view their own documents query 我尝试使用此查询来查看仅针对通过其帐户上传的用户的文档,这意味着用户只能查看自己的文档查询
ALTER procedure [dbo].[dddddd]
@userid int
as
SELECT DISTINCT DocumentInfo.DocID as DocumentID ,
dbo.DocumentInfo.DocName as DocumentName,
dbo.DocumentInfo.Uploadfile as FileUploaded,
dbo.DocType.DocType as Document,
dbo.Department.DepType as Department ,
dbo.ApproveType.ApproveType AS ApproveID
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.ApproveType.approveid=dbo.DocumentInfo.ApproveID
LEFT
OUTER JOIN
Approval a ON a.DocID = a.DocID
JOIN
ApproveType at ON at.ApproveID = ISNULL(a.Approveid, 3) where UserID=@userid
but it shows me error 但它显示我错误
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'DocID'."
in this line 在这条线
<td><%#DataBinder.Eval(Container.DataItem,"DocID") %></td>
where is the mistake 错误在哪里
There is no DocID being returned in your query as you have aliased the column to be DocumentID
. 由于将列别名为
DocumentID
查询中没有返回DocID。
Change to this instead: 改为此:
<td><%#DataBinder.Eval(Container.DataItem,"DocumentID") %></td>
Also is your left outer join
correct? 您的
left outer join
是否正确? You seem to be using the same table on both sides of the query. 您似乎在查询的两边都使用了相同的表。 More of an observation.
更多的观察。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.