Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i try to search records in asp.net for this first i create sp

SQL
ALTER procedure [dbo].[spsearchdocuments]
@Name  nvarchar(50)
as
SELECT     dbo.DocumentInfo.DocID as DocumentID,
 dbo.DocumentInfo.DocName as DocumentName,
 dbo.DocumentInfo.Uploadfile as FileUploaded,
   dbo.DocumentInfo.UploadedDate as UploadedDate,
 dbo.Department.DepType as Department,
dbo.DocType.DocType as Document,
dbo.DocumentInfo.UploadedBy as UploadedBy,
dbo.Approval.AppoveBy, dbo.ApproveType.ApproveType as Status
FROM         dbo.DocumentInfo INNER JOIN
                      dbo.Approval ON dbo.DocumentInfo.DocID = dbo.Approval.DocID INNER JOIN
                      dbo.ApproveType ON dbo.Approval.ApproveID = dbo.ApproveType.ApproveID INNER JOIN
                      dbo.Department ON dbo.DocumentInfo.DepID = dbo.Department.DepID INNER JOIN
                      dbo.DocType ON dbo.DocumentInfo.DocTypeID = dbo.DocType.DocTypeID
where [DocName] like @Name+'%'


and then when i call this sp in funtion like this

C#
public DataTable searchdcouments(string Name )
        {

            return db.ExecuteDataSet("spsearchdocuments", new object[] { Name }).Tables[0];
        }


and when i call this funtion in .aspx form behind search button like this

C#
protected void Btn_submits_Click(object sender, EventArgs e)
        {         
            Repeater4.DataSource = sear.searchdcouments(searz.Text);
            Repeater4.DataBind();           
        }


and when i debug my project and write keyword then it not show me any record where record exist in database have a look below pictures when i enter keyword keyword
image1[^]

and when i click on search button it shows me like this show no records.
image2[^]
Posted
Updated 23-Jan-14 8:47am
v2
Comments
Ranjan.D 23-Jan-14 14:53pm    
Try putting a breakpoint on the below line and see whether you are getting a DataTable filled with rows in it.

Repeater4.DataSource = sear.searchdcouments(searz.Text);
Diya Ayesa 24-Jan-14 5:56am    
it show me datasource null when i set a brakpoint
arindamrudra 23-Jan-14 18:13pm    
Aru you getting the datatable properly?
JoCodes 23-Jan-14 22:24pm    
Debug and check the query is returning any rows. Even you can use sqlprofiler .
samit kaneriya 24-Jan-14 6:01am    
use like '%'+@Name+'%'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900