如何从asp.net中的数据库中获取特定时间段的数据? [英] how to fetch data of a particular time period from database in asp .net?

查看:212
本文介绍了如何从asp.net中的数据库中获取特定时间段的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有两个日历,想要从特定时间段的数据库中提取数据。我的意思是说我希望从2013年1月1日到2013年2月1日在gridview中显示数据。请建议我使用C#进行完整编码。谢谢....

I have two calendars in my application and want to extract data from database of a particular time period. I mean to say I want to display data in gridview from 01/01/2013 to 01/02/2013. please suggest me with full coding in C#. Thanks....

推荐答案

请建议我使用C#进行完整编码。

对不起,它不会像这样工作。



以下是对询问者的期望:

1. 首先尝试你想做什么!你可能会发现它并不那么难。

2.制定你所做的事情看似问题/不工作。







对于您的问题,以下内容将有所帮助:

1.您的查询应具有日期的WHERE子句,例如,

please suggest me with full coding in C#.
Sorry, it does not work like this.

Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it''s not that hard.
2. Formulate what was done by you that looks like an issue/not working.



For your question, following will help:
1. Your query should have WHERE clause for date like,
SELECT * FROM MyTable WHERE dateColumn BETWEEN @startDate AND @endDate



2.关于ADO.NET的研究: MSDN:ADO.NET [ ^ ]


这篇关于如何从asp.net中的数据库中获取特定时间段的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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