0

我尝试此查询仅查看通过其帐户上传的人的文档意味着用户仅查看自己的文档查询

 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

但它告诉我错误

DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'DocID'."

在这一行

  <td><%#DataBinder.Eval(Container.DataItem,"DocID") %></td>

错误在哪里

4

1 回答 1

4

您的查询中没有返回 DocID,因为您已将该列别名为DocumentID.

改为:

 <td><%#DataBinder.Eval(Container.DataItem,"DocumentID") %></td>

你的也对left outer join吗?您似乎在查询的两边都使用同一个表。更多的是观察。

于 2013-10-24T08:33:08.810 回答