public bool Equals(DSSqlPair p) { // If parameter is null return false: if ((object)p == null) { return(false); } // Return true if the fields match: return((DataSource == p.DataSource) && (Sql == p.Sql)); }
private void btnOK_Click(object sender, EventArgs e) { MultiDataSource.Clear(); foreach (DataGridViewRow r in this.dataGridView1.Rows) { string ds = r.Cells[0].Value.ToString(); if (string.IsNullOrEmpty(ds)) { MessageBox.Show("数据源不可为空"); return; } string sql = r.Cells[1].Value.ToString(); if (string.IsNullOrEmpty(sql)) { MessageBox.Show("Sql语句不可为空"); return; } DSSqlPair dsp = new DSSqlPair(ds, sql); MultiDataSource.Add(dsp); } this.DialogResult = DialogResult.OK; this.Close(); }