/// <summary> /// 쿼리를 실행하고 리턴값을 넘긴다. /// </summary> /// <param name="strQuery"></param> /// <returns></returns> public DataSet dsExcute(string strClientName, string strQuery) { OleDB clsDb = new OleDB(strConn); try { DataSet ds = clsDb.dsExcute_Query(strQuery); if (evtdsExcute != null) { evtdsExcute(strClientName, strQuery); } return(ds); } catch (Exception ex) { if (evtdsExcuteError != null) { evtdsExcuteError(strClientName, strQuery, ex); } throw; } }
private void btnXlsLoad_Click(object sender, EventArgs e) { try { OpenFileDialog dial = new OpenFileDialog(); dial.Multiselect = false; dial.ShowDialog(); string strFileName = dial.FileName; dial.Dispose(); if (strFileName == string.Empty) { return; } strFileName = strFileName.Replace(@"\\", @"\"); //strFileName = @".\chasys.xls"; OleDB clsOle = new OleDB(OleDB.enProvider.Excel, strFileName, string.Empty, string.Empty, string.Empty); using (DataSet ds = clsOle.dsExcute_Query("select orderdate, partcode, target_cnt from [order$]")) { if (ds.Tables[0].Rows.Count < 1) { return; } lstPlan.Items.Clear(); ResetInput(); foreach (DataRow dr in ds.Tables[0].Rows) { lstPlan.Items.Add(new ListViewItem(new string[] { (lstPlan.Items.Count + 1).ToString(), Fnc.obj2String(dr["ORDERDATE"]), Fnc.obj2String(dr["PARTCODE"]), Fnc.obj2String(dr["TARGET_CNT"]) })); } } } catch (Exception ex) { clsLog.WLog_Exception("btnXlsLoad", ex); Fnc.ShowMsg(this, ex.Message, string.Empty, frmMessage.enMessageType.OK); } }