public void SetCommand(SwitcherCommand cmd) { this.Command = cmd; var result = new DataTable(); using (var conn = new SqlConnection(ConfigurationEngine.Configuration.ConnectionString)) { conn.Open(); var sqlCmd = new SqlCommand(this.Command.Sql, conn); var adapter = new SqlDataAdapter(sqlCmd); adapter.Fill(result); conn.Close(); } if (this.Command.PopupHeight > 120) { this.Height = this.Command.PopupHeight; } if (this.Command.PopupWidth > 30) { this.Width = this.Command.PopupWidth; } this.Text = this.Command.Name.Replace("&", ""); this.gridViewCmdData.DataSource = result; }
public FormShowData() { InitializeComponent(); this.Command = null; }