Problem figuring out DataGridView
-
I've got 2 columns, Column Catagory, and Column Item. I've got them displaying from drop down boxes, but when I pick a catagory, I dont know how to force the Item Column to update for the items from the selected Catagory. I hope that made sense... (no, I'm not doing this for homework, and my database doesn't actually involve cars) [Catagory] [Item] |Car| |Acura| |Truck| |Accord| |Tacoma| Hopefully the above is a reasonable "view" of what I've got. There is a catagory table, and an item table. The item table has the catagory number from catagory table with each item. Thanks for the help.
-
I've got 2 columns, Column Catagory, and Column Item. I've got them displaying from drop down boxes, but when I pick a catagory, I dont know how to force the Item Column to update for the items from the selected Catagory. I hope that made sense... (no, I'm not doing this for homework, and my database doesn't actually involve cars) [Catagory] [Item] |Car| |Acura| |Truck| |Accord| |Tacoma| Hopefully the above is a reasonable "view" of what I've got. There is a catagory table, and an item table. The item table has the catagory number from catagory table with each item. Thanks for the help.
Hi, DataSet ds; DataViewManager dsview; In the form_load write this: string constr = "Data Source=KALPANA\\KAL; Trusted_Connection = yes;Database=Northwind"; SqlConnection con = new SqlConnection(constr); SqlDataAdapter da1 = new SqlDataAdapter("SELECT * FROM category", con); ds = new DataSet("category"); da1.TableMappings.Add("Table", "category"); da1.Fill(ds); SqlDataAdapter da2 = new SqlDataAdapter("SELECT * FROM item", con); da2.TableMappings.Add("Table", "item"); da2.Fill(ds); string dt = ""; for (int i = 0; i < ds.Tables.Count; i++) { dt += "Table Mappings" + i.ToString() + " " + ds.Tables[i].ToString() + " "; } //MessageBox.Show(dt); DataRelation relcatitem; DataColumn colmast; DataColumn coldet; colmast= ds.Tables["category"].Columns["catid"]; coldet = ds.Tables["item"].Columns["catid"]; relcatitem = new DataRelation("relcatitem", colmast, coldet); ds.Relations.Add(relcatitem); for(int j=0;j
-
I've got 2 columns, Column Catagory, and Column Item. I've got them displaying from drop down boxes, but when I pick a catagory, I dont know how to force the Item Column to update for the items from the selected Catagory. I hope that made sense... (no, I'm not doing this for homework, and my database doesn't actually involve cars) [Catagory] [Item] |Car| |Acura| |Truck| |Accord| |Tacoma| Hopefully the above is a reasonable "view" of what I've got. There is a catagory table, and an item table. The item table has the catagory number from catagory table with each item. Thanks for the help.