使用DataView;
private void comboBox2_SelectedIndexChanged(object sender, System.EventArgs e)
{
DataView dv = new DataView(this.ds.Tables[0]);
dv.RowFilter = "pid = '"+this.comboBox1.Items[this.comboBox1.SelectedIndex].ToString()+
         "'and cid = '"+this.comboBox2.Items[this.comboBox2.SelectedIndex].ToString()+"'";
         this.DataGrid1.DataSource = dv;
}
这里需要注意的是如果pid和cid是数字就写成:
dv.RowFilter = "pid = "+this.comboBox1.Items[this.comboBox1.SelectedIndex].ToString()+
         " and cid = "+this.comboBox2.Items[this.comboBox2.SelectedIndex].ToString();
如果是字符,就把单引号加上。