简体   繁体   中英

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 .

Change to this instead:

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

Also is your left outer join correct? You seem to be using the same table on both sides of the query. More of an observation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM