比较asp.net中的当前日期字段 [英] comparing current date field in asp.net

查看:81
本文介绍了比较asp.net中的当前日期字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我正在通过将数据库列与我的AJAX控件选择日期进行比较来搜索表数据.
我的问题是数据库列将getdate()用作输入.
如何从我的程序中搜索它?
我该如何处理?
真的很感谢您的帮助.

Hello friends,

I am searching data of table by comparing a database column to my AJAX control picked date.
My problem is that the database column is taking getdate() as input.
How am I able to search it from my procedure?
How can I handle it?
Any help is really appreciated.

推荐答案

如果您的表使用getdate()作为填充表的值,那么这应该不是问题,如果它使用的是GetDate ()查询表,那么显然这将是一个问题.

假设表已经用getdate()填充,那么用于处理AJAX请求的服务器端方法将类似于

If your table is taking getdate() as a value to populate the table this should not be an issue, if it is using GetDate() to query the table then obviously this will be an issue.

Assuming the table has been populated with getdate() then your server side method for handling the AJAX request would be something like

Select <column> from <table> where <date column> = <date passed by ajax>



要返回正确的列,您将使用这些列来制定AJAX响应.



To return the correct column(s) - you will then use these columns to formulate your AJAX response.


将日期作为参数发送给过程时
在使用之前进行转换CONVERT(varchar(10),@ Date,101)

有关转换的更多信息,请关注

http://www.sqlusa.com/bestpractices/datetimeconversion/

-nilesh
when you send date to procedure as a parameter
convert in before using e.g. CONVERT(varchar(10),@Date,101)

for more info about convert follow

http://www.sqlusa.com/bestpractices/datetimeconversion/

- nilesh


这篇关于比较asp.net中的当前日期字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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