/// <summary> ///根据传入的字符串查询结果绑定数据 ///王冀 2012 10 24 ///edit zyx 2012-12-17 系统参数配置中,当查询不到结果时给出提示框 ///edit by xlb 2012-12-28 改用参数化查询 /// </summary> /// <param name="key"></param> private void BindData(string sql, string key) { try { //sql_helper = DataAccessFactory.DefaultDataAccess; appdal = new AppConfigDalc(); //sourceTable = sql_helper.ExecuteDataTable(sql_str); SqlParameter[] sps = { new SqlParameter("@conName", key) }; //DataTable sourceTable = sql_helper.ExecuteDataTable(key); DataTable sourceTable = DS_SqlHelper.ExecuteDataTable(sql, sps, CommandType.Text); if (sourceTable == null || sourceTable.Rows.Count <= 0) { MessageBox.Show("没有符合条件的数据"); } gridControl1.DataSource = sourceTable; //if (sourceTable == null || sourceTable.Rows.Count <= 0) //{ // MessageBox.Show("没有符合您查询的系统参数配置的相关数据!"); //} m_app.PublicMethod.ConvertGridDataSourceUpper(gridView1); //绑定数据 查询结构加载时 changed事件获取不到句柄 不能自动绑定数据需要手动加载 2012-10-25 DataRow dataRow = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (dataRow == null) { return; } SetApp(dataRow); AddControlToMyPanel(dataRow); } catch (Exception) { throw; } }
private void GetDefaultSeting() { AppConfigDalc _AppConfigDalc = new AppConfigDalc(); m_EmrAppConfig = _AppConfigDalc.SelectAppConfig("EmrDefaultSet"); //XMLCommon; if (m_EmrAppConfig == null) { button3_Click(null, null); } m_XmlDocument.LoadXml(m_EmrAppConfig.Config); //XMLCommon _XMLCommon = new XMLCommon(); this.comboBox1.SelectedItem = m_XmlDocument.GetElementsByTagName("fontname").Item(0).InnerText; this.comboBox2.Text = m_XmlDocument.GetElementsByTagName("fontsize").Item(0).InnerText; this.comboBox3.SelectedIndex = Convert.ToInt32(Convert.ToDouble(m_XmlDocument.GetElementsByTagName("linespace").Item(0).InnerText) * 2); this.comboBox4.SelectedItem = m_XmlDocument.GetElementsByTagName("elestyle").Item(0).InnerText; this.labelColor.BackColor = ColorTranslator.FromHtml(m_XmlDocument.GetElementsByTagName("elecolor").Item(0).InnerText); this.checkBox1.Checked = false; }