0

i try to show documents with specific department id

computer-science admin will be able to view only computer-science documents and hr admin view only hr documents

here i create a sp

ALTER procedure [dbo].[sphrdocid1]

     @DepID int
   as
    SELECT DocumentInfo.DocID,
 dbo.DocumentInfo.DocName,
    dbo.DocumentInfo.Uploadfile,
   dbo.DocType.DocType,
   dbo.Department.DepType ,
    dbo.ApproveType.ApproveType AS ApproveID
    FROM dbo.DocumentInfo
       left JOIN dbo.DocType ON dbo.DocumentInfo.DocTypeID=dbo.DocType.DocTypeID
 left JOIN dbo.Department ON dbo.DocumentInfo.DepID=dbo.Department.DepID
    LEFT JOIN dbo.ApproveType ON  
    dbo.ApproveType.approveid=dbo.Department.DepID            
     where    
 dbo.Department.DepID=@DepID



then when i test the query and write this "sphrdocid1 6" it show me like this

 DocID DocDesciption    DocName     Uploadfile       DocTypeID     
    **DepID**                 **UploadedBy**                 UserID

8   paperssSSS  SDASDASD        dsfsdf.docx 1
**4**                      **john**                 **6**

9   hr report   dr reprt n analysis     HR.docx 1
**4**                                   **john**             **6**

and on page load function

GrdFileApprove.DataSource = dd.gethrdoc22(Convert.ToInt32(Session["Userid"]));
            GrdFileApprove.DataBind();

and

 public DataTable hrdoc1(int id)
    {
        return db.ExecuteDataSet("sphrdocid1", new object[] { id }).Tables[0];


    }

when i set a breakpoint it shows me id 0 ..

and when i debug it can not show me any documents in form

where is the probelem?
2
Contributors
3
Replies
17
Views
4 Years
Discussion Span
Last Post by ggamble
0

hrdocid1 is sp and id is set in funtion..
DataTable table = db.ExecuteDataSet("sphrdocid1", new object[] { id }).Tables[0];

        return table;
0

Your trying to turn a DataSet into a Table explicitly which might not work ... try this:

 public DataTable hrdoc1(int id)
{
    DataSet ds = (Call DataSet here)
    DataTable dt = ds.tables[0];
    return dt;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.