我嘗試搜索asp.net中記錄了這首,我創建存儲過程:搜索記錄
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+'%'
,然後當我把這個過程中的功能,這樣
public DataTable searchdcouments(string Name)
{
return db.ExecuteDataSet("spsearchdocuments", new object[] { Name }).Tables[0];
}
,當我撥打的.aspx形式此功能的背後是這樣
protected void Btn_submits_Click(object sender, EventArgs e)
{
Repeater4.DataSource = sear.searchdcouments(searz.Text);
Repeater4.DataBind();
}
搜索按鈕,當我調試米Ÿ項目並寫入關鍵字,然後它不告訴我在哪裏記錄在數據庫中存在的任何記錄
看看下面的圖片
當我輸入關鍵字
看看,當我點擊搜索按鈕它讓我這樣
我會檢查searz.Text以確保它沒有尾隨空格。 –
plz檢查這