根据输入的日期从gridview中搜索数据 [英] search the data from gridview according to entered dates

查看:42
本文介绍了根据输入的日期从gridview中搜索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的大家,美好的一天!
正在使用Asp.net,C#和SqlServer2005.

我需要根据日期(从和到)从Gridview搜索记录

在我的网页上,我有一个Gridview和Textboxes作为

从:DDTextbox MMTextbox YYTextbox到:DD1textbox MM1txtbox YY1txtbox-SearchButton

如果用户输入起始日期"和截止日期",然后单击搜索"按钮,则应搜索到该日期的所有记录

例如:如果用户要搜索从:2012年7月29日到2012年8月29日

它必须显示这些FROM和TO记录....他搜索的内容.

在gridview中,我有一个字段为EmpId,EmployeeName,JoinDate ...

现在我需要搜索加入日期(从和到)


请帮忙.

Dear All, Good Day !!

Am working on Asp.net , C# , SqlServer 2005.

I need to Search the Records From Gridview based on the Dates ( From and To)

on my webpage I have a Gridview and Textboxes as

From : DDTextbox MMTextbox YYTextbox To :DD1textbox MM1txtbox YY1txtbox - SearchButton

if the user enters FROM date and TO Date and Clicks on search button it should search all the records to that entered dates

for example : if the user wants to search From : 29/07/2012 TO : 29/08/2012

it must display these FROM and TO Records....what ever he searches.

In gridview I have a Fields as EmpId,EmployeeName,JoinDate...

Now i need to search the join dates ( FROM and TO)


Please help.

Thanks for ever.

推荐答案

您所需要的只是一个带有搜索参数的查询,该查询将获取记录.提取后,您需要将它们绑定到网格.

查询将类似于:
All you need is a query with search parameters in it that will fetch records. Once fetched, you need to bind them to the grid.

Query would be something like:
SELECT 
   EmpId, Employeename, JoinDate
FROM
   MyEmployeeTable
WHERE
   JoinDate BETWEEN @FromDate AND @ToDate


这篇关于根据输入的日期从gridview中搜索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆