本文介绍了当Fromdate和Todate是相同的日期时,如何从两个日期之间的数据库中获取数据。即(2012年2月2日和2012年2月2日)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 您好我想从两个日期之间获取数据库中的数据,其中Fromdate和Todate是相同的日期。即(2012年2月2日和2012年2月2日)。现在我正在使用这个查询 选择 std.reg_no ,std.stud_name,bat.batch_name, convert ( varchar ,col.amt_received_date, 103 ) as amt_received, col.receipt_no,col.fee_amt,adm.username 来自 tbl_collections col join tbl_admin adm on adm.id = col.id join tbl_student std on col.sid = std.sid join tbl_batches bat on std.bid = bat.bid 其中 adm.username=@username 和 amt_received_date @fromdate 和 @ todate 但是我得不到我想要的正确结果,我的后端代码是这样的。 protected void onselect_change( object sender,EventArgs e) { try { string fdate = txtCalendar.Text.ToString(); string tdate = txtCalendar1.Text.ToString(); DateTime fromd = DateTime.Parse(fdate,System.Globalization.CultureInfo.InvariantCulture); DateTime tod = DateTime.Parse(tdate,System.Globalization.CultureInfo.InvariantCulture); string user = cashier_list.SelectedItem.Text; DataSet ds2 = new DataSet(); ds2 = obj.fee_collectionsreport( 3 , 0 ,user,fromd,tod); collection_grid.DataSource = ds2; collection_grid.DataBind(); } catch {} } 给我解决方案查询条款或C#backend 解决方案 Hi i want to get the data from database between two dates where Fromdate and Todate are same date. i.e (2/2/2012 and 2/2/2012). right now i'm using this query select std.reg_no,std.stud_name,bat.batch_name,convert(varchar,col.amt_received_date,103) as amt_received,col.receipt_no,col.fee_amt,adm.username from tbl_collections col join tbl_admin admon adm.id=col.id join tbl_student std on col.sid=std.sid jointbl_batches bat on std.bid=bat.bid where adm.username=@username AND amt_received_date between @fromdate and @todatebut i'm not getting the correct result as i want and my back end code is like this.protected void onselect_change(object sender, EventArgs e){ try { string fdate = txtCalendar.Text.ToString(); string tdate = txtCalendar1.Text.ToString(); DateTime fromd = DateTime.Parse(fdate, System.Globalization.CultureInfo.InvariantCulture); DateTime tod = DateTime.Parse(tdate, System.Globalization.CultureInfo.InvariantCulture); string user = cashier_list.SelectedItem.Text; DataSet ds2 = new DataSet(); ds2 = obj.fee_collectionsreport(3, 0, user, fromd, tod); collection_grid.DataSource = ds2; collection_grid.DataBind(); } catch { }}give me solution in terms of query OR C# backend 解决方案 这篇关于当Fromdate和Todate是相同的日期时,如何从两个日期之间的数据库中获取数据。即(2012年2月2日和2012年2月2日)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-30 14:43