Example #1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        protected int Query()
        {
            string tempSQL   = null;
            string strErr    = null;
            string strDept   = null;
            string strDeptNM = null;

            strDept   = cmbDept.SelectedItem.ID;
            strDeptNM = cmbDept.SelectedItem.Name;



            tempSQL = string.Format(strSQL, strDept);
            try
            {
                interManager.ExecQuery(tempSQL, ref ds);
            }
            catch (Exception ex)
            {
                strErr = "查询数据失败!" + ex.Message;
                MessageBox.Show(strErr);
                return(-1);
            }

            //向fp内添加数据
            if (ds.Tables.Count > 0)
            {
                neuSpread1_Sheet1.DataSource = ds.Tables[0].DefaultView;
                Filter();
            }

            lbTitle1.Text = "查询科室:" + strDeptNM +
                            "                   共:" + ds.Tables[0].Rows.Count.ToString() + "条记录";
            return(1);
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        protected int Query()
        {
            string   tempSQL   = null;
            string   strErr    = null;
            string   strDept   = null;
            string   strDeptNM = null;
            DateTime dtBegin   = new DateTime();
            DateTime dtEnd     = new DateTime();

            dtBegin = new DateTime(this.dtpBeginDate.Value.Year, this.dtpBeginDate.Value.Month, this.dtpBeginDate.Value.Day, 0, 0, 0);
            dtEnd   = new DateTime(this.dtpEndDate.Value.Year, this.dtpEndDate.Value.Month, this.dtpEndDate.Value.Day, 23, 59, 59);

            strDept   = cmbDept.SelectedItem.ID;
            strDeptNM = cmbDept.SelectedItem.Name;



            tempSQL = string.Format(strSQL, dtBegin, dtEnd, strDept);
            try
            {
                interManager.ExecQuery(tempSQL, ref ds);
            }
            catch (Exception ex)
            {
                strErr = "查询数据失败!" + ex.Message;
                MessageBox.Show(strErr);
                return(-1);
            }

            //向fp内添加数据
            if (ds.Tables.Count > 0)
            {
                neuSpread1_Sheet1.DataSource = ds.Tables[0].DefaultView;
                Filter();
            }

            lbTitle1.Text = "查询时间:" + dtpBeginDate.Value.ToShortDateString() +
                            "至" + dtpEndDate.Value.ToShortDateString() +
                            "                   查询科室:" + strDeptNM +
                            "                   共:" + ds.Tables[0].Rows.Count.ToString() + "条记录";
            return(1);
        }