public DataSet ExecuteSQLCommand(QueryLunchDTO dto) { DataSet dsResult = null; QueryLunchDAO dao = new QueryLunchDAO(CommonLib.Common.CurrentDatabase); dsResult = dao.ExecuteSQLCommand(dto); return(dsResult); }
public DataSet ExecuteSQLCommand(QueryLunchDTO dto) { Database db = m_db; string sql = @" begin tran exec (@SqlCommand) rollback"; DataRequest req = new DataRequest(); req.CommandText = sql; req.CommandType = CommandType.Text; req.Parameters.Add("@SqlCommand", dto.SQLCommand.Value); return(db.ExecuteDataSet(req)); }
private void LoadData() { try { QueryLunchDTO dto = new QueryLunchDTO(); dto.SQLCommand = this.txtSearch.Text.ToNZString(); QueryLunchBiz biz = new QueryLunchBiz(); DataSet dsResult = biz.ExecuteSQLCommand(dto); this.m_dtAllData = null; this.shtView.DataSource = null; this.shtView.RowCount = 0; this.shtView.ColumnCount = 0; if (dsResult.Tables.Count > 0) { if (dsResult.Tables[0].Rows.Count > 0) { this.m_dtAllData = dsResult.Tables[0]; this.shtView.DataSource = m_dtAllData; } else { MessageBox.Show("หาไม่เจอเว้ยยยยยยยย"); } } else { MessageBox.Show("query ภาษาอะไรวะ"); } } catch (DataAccessException ex) { MessageBox.Show("ไปเรียน Query ใหม่ซะไป๊"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void fpQueryList_SelectionChanged(object sender, FarPoint.Win.Spread.SelectionChangedEventArgs e) { this.shtView.DataSource = null; this.shtView.RowCount = 0; this.shtView.ColumnCount = 0; this.m_dtAllData = null; if (m_dtQueryList != null) { object o = shtQueryList.Cells[e.Range.Row, (int)eColQueryList.ID].Value; if (o != null) { string strID = Convert.ToString(o); DataRow[] dr = m_dtQueryList.Select(eColQueryList.ID.ToString() + "='" + strID + "'"); //DataView dv = m_dtQueryList.DefaultView; //dv.RowFilter = eColQueryList.ID.ToString() + "='" + strID + "'"; if (dr.Length > 0) { QueryLunchDTO dto = DTOUtility.ConvertDataRowToDTO <QueryLunchDTO>(dr[0]); this.txtSearch.Text = dto.SQLCommand; this.txtStartRow.Text = Convert.ToString(dto.StartRow); this.txtStartColumn.Text = Convert.ToString(dto.StartColumn); this.txtTemplate.Text = dto.ExcelTemplate; //this.txtSearch.Text = dr[0]["SQLCommand"].ToString();//dto.SQLCommand; //this.txtStartRow.Text = dr[0]["StartRow"].ToString();//Convert.ToString(dto.StartRow); //this.txtStartColumn.Text = dr[0]["StartColumn"].ToString();//Convert.ToString(dto.StartColumn); //this.txtTemplate.Text = dr[0]["ExcelTemplate"].ToString();//dto.ExcelTemplate; } } } }