SearchBySql
Java: public List<Accountingdisclosure> searchAccountingdisclosuresBySql(String sqlStr)throws Exception { DBOperator dbo = getDBOperator(); try { AccountingdisclosureTableAdapter adapter = new AccountingdisclosureTableAdapter(dbo); return adapter.select(sqlStr); } catch (Exception e) { dbo.rollback(); throw e; } finally { dbo.close(); } } Sql="(createddate>=‘2013-02-18 00:00:00‘ and createddate<=‘2013-02-18 23:59:59‘)";
.NET: private void LoadAccountingDisclosureData() { AccountingCollection.Clear(); string starttime = DateTime.Now.Date.ToString("yyyy-MM-dd") + " 00:00:00"; string endtime = DateTime.Now.Date.ToString("yyyy-MM-dd") + " 23:59:59"; string sql = "(createddate>=‘" + starttime + "‘ and createddate<=‘" + endtime+"‘)"; //Sql="(createddate>=‘2013-02-18 00:00:00‘ and createddate<=‘2013-02-18 23:59:59‘)"; List<Accountingdisclosure> accountings = accountingAction.SearchAccountingdisclosuresBySql(sql); if (accountings != null && accountings.Count>0) { IOrderedEnumerable<Accountingdisclosure> orders = accountings.OrderByDescending(a => a.Createddate); foreach (Accountingdisclosure accounting in orders) { AccountingCollection.Add(accounting); } } }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。