tb_plane============plane_id plane_name tb_attributes==============attribute_idattribute_name
tb_as_plane_attributes========================plane_attribute_idFK_plane_idFK_attribute_id value
private SqlDataAdapter CreateDataAdapter(string sql) { return new SqlDataAdapter(sql, conSettings.ConnectionString); } private DataSet GetDataSet(string tableName, string sql) { DataSet dataSet = new DataSet(); CreateDataAdapter(selectCommandText).Fill(dataSet, tableName); return dataSet; } private DataTable GetDataTable(string sql) { DataTable dt = new DataTable(); CreateDataAdapter(selectCommandText).Fill(dt); return dt; } private void PopulatePlainComboBox() { try { CboPlains.DataSource = GetDataTable("SELECT plane_id, plane_name FROM tb_plane"); CboPlains.DisplayMember = "plane_name"; CboPlains.ValueMember = "plane_id"; } catch (System.Exception ex) { string str = "Source:" + ex.Source + "\n" + "Message:" + ex.Message; MessageBox.Show(str, "Generic Exception"); } } private void PopulateGridByAttributes() { DataTable dataTable = GetDataTable("SELECT attribute_id, attribute_name FROM tb_attributes"); GrdAllAttributes.Columns.Add("attribute_name", "name of attribute"); GrdAllAttributes.Columns.Add("dd", "Value"); foreach (DataRow row in dataTable.Rows) { GrdAllAttributes.Rows.Add(row[1]); } }