当我选择组合框的索引时出现异常。例外是The multi-part identifier "System.Data.DataRowView" could not be bound.
请帮助我如何通过选择组合框的值从datagridview中的sql获取数据”?
string connectionString = @"Data Source=YASHPAL-VAIO;Initial Catalog=Akb;Integrated Security=True";
string sq = "SELECT * FROM studentinformation where registrationnumber= '" + comboBox1.SelectedItem + "'";
SqlConnection connection = new SqlConnection(connectionString);
SqlDataAdapter dataadapter = new SqlDataAdapter(sq, connection);
DataSet ds = new DataSet();
connection.Open();
dataadapter.Fill(ds);
connection.Close();
dataGridView1.DataSource = ds.Tables[0];