I have some tables in the db:
Items Manufacturers Categories Cities Regions
============== ================ ============ ======== ==========
ItemId ManufacturerId CategoryId CityId RegionId
ManufacturerId CityId NameCategory RegionId NameRegion
CategoryId NameManufacturer NameCity
NameItem
Weight
I am displaying the list of the items in DataGridView
using this code:
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select * from Items", connectionString);
SqlCommandBuilder cmdBldr = new SqlCommandBuilder(da);
da.Fill(ds, "Items");
dataGridView1.DataSource = ds.Tables[0];
I also have button that save the changes in the DataGridView
with this code:
da.Update(ds, "Items");
I want to replace two columns in datagridview - ManufacturerId
and CategoryId
with the NameManufacturer
and NameCategory
from related tables. So those two columns should be ComboBox with all possible names from related tables - to be able to change the Category
or Manufacturer
to other and save it using da.Update().
I also need to add three combobox filters for the datagridview:
Category
, City
and Region
, that will filter the displayed items in the datagridview by selected values in those filters.
I can't use wizard creator, I have to do it all in the code. If you could give me some ideas related to any part of this, will be great.