如何在文本框中找到2个日期之间的详细信息 [英] how to find the detail between 2 dates put in text box

查看:72
本文介绍了如何在文本框中找到2个日期之间的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在两个文本框中输入2个日期,我有2个文本框,然后单击按钮,它将在2个日期之间生成数据库中的所有详细信息。



使用asp.net rozer文件

i have 2 text box if i enter 2 dates in the two textbox and click the button it will generate all the details from the database in between 2 dates.

use asp.net rozer file

推荐答案

[HttpPost]

public ActionResult CashReceipt(string FromDate,string ToDate)

{

列表< cashreceipts> adList = new List< cashreceipts>();

CashReceipts crObj = new CashReceipts();

DataSet ds = new DataSet();

string fromDate = Convert.ToString(FromDate);

string toDate = Convert.ToString(ToDate);

Cashrecetps cr = new Cashrecetps();

ds = cr.GetReport(fromDate,toDate);

if(ds!= null&& ds.Tables.Count> 1)



{

for(int record = 0; record< = ds.Tables [0] .Rows.Count - 1; record ++)

{



dynamic rowLB = ds.Tables [0] .Rows [record];

crObj.Date = rowLB(Date)。 ToString();

crObj.Amount = rowLB(Amount)。ToString();

crObj.Description = rowLB(Description)。ToString();

crObj.User = rowLB(User)。ToString();

}

adList.Add(crObj);

}

返回查看(crObj);

}
[HttpPost]
public ActionResult CashReceipt(string FromDate, string ToDate)
{
List<cashreceipts> adList = new List<cashreceipts>();
CashReceipts crObj = new CashReceipts();
DataSet ds = new DataSet();
string fromDate = Convert.ToString(FromDate);
string toDate = Convert.ToString(ToDate);
Cashrecetps cr = new Cashrecetps ();
ds = cr.GetReport(fromDate, toDate);
if (ds != null && ds.Tables.Count > 1)

{
for (int record = 0; record <= ds.Tables[0].Rows.Count - 1; record++)
{

dynamic rowLB = ds.Tables[0].Rows[record];
crObj.Date = rowLB("Date").ToString();
crObj.Amount = rowLB("Amount").ToString();
crObj.Description = rowLB("Description").ToString();
crObj.User = rowLB("User").ToString();
}
adList.Add(crObj);
}
return View(crObj);
}


这篇关于如何在文本框中找到2个日期之间的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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