SearchBySql

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‘)";
SearchBySql
SearchBySql
.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);
                }
            }

        }
SearchBySql

SearchBySql

上一篇:Python之sys.argv[]


下一篇:022-Python对象的生命周期和周期方法