using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DBFactory; namespace wcfControlMonitorClient { public partial class FrmAheadDetect : Form { DBOperator dbo = CStaticClass.dbo; private static FrmAheadDetect _formInstance; public static FrmAheadDetect FormInstance { get { if (_formInstance == null) { _formInstance = new FrmAheadDetect(); } return _formInstance; } set { _formInstance = value; } } public FrmAheadDetect() { InitializeComponent(); } private void FrmAheadDetect_Load(object sender, EventArgs e) { button_Refresh_Click(null, EventArgs.Empty); } private void dataGridView2_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if ((e.ColumnIndex >= 0) && (e.RowIndex >= 0) && (e.Button == MouseButtons.Right)) { dataGridView2.ClearSelection(); dataGridView2.Rows[e.RowIndex].Selected = true; dataGridView2.CurrentCell = dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex]; } } private void FrmAheadDetect_FormClosing(object sender, FormClosingEventArgs e) { _formInstance = null; } private void btSave_Click(object sender, EventArgs e) { } private void button_Refresh_Click(object sender, EventArgs e) { string CommomSql = "select F_DeviceIndex as 起点设备编号, F_GoalDeviceIndex as 终点设备编号,F_TaskType as 任务类型, F_CommondIndex as 命令索引,F_CommondName as 命令名称, F_AheadDetect as 提前检测规则 from T_Base_AheadDetect"; DataView dv = dbo.ExceSQL(CommomSql).Tables[0].DefaultView; this.dataGridView2.DataSource = dv; } } }