|
Subject:
|
Restricting the data in a ComboBox
|
|
Posted By:
|
hemanth_p2p
|
Post Date:
|
12/9/2005 1:08:54 PM
|
Hi, Here is the problem: I have two ComboBox's. I am trying to do a drill down based on the selection of each box. For example, I get the data for CB1 from the database and fill it.If CB1 is let's say..project_id and I select one project_id, I want CB2 to be filled with Group_id's for that project. Finally after all the selection's are made I want the data of Group_Id selected in CB2 to be displayed in a DataGrid. Here is what I did: I tried passing the parameter in Fill(), but for some reason I do not get any data. I am using a SQL Server2000 DB.
I am still stuck at the first step
Thanking you in anticipation for a solution 
----
Distributed computing ->Causality-> EventDriven ->We have the last laugh.!!
|
|
Reply By:
|
bourema
|
Reply Date:
|
1/9/2006 3:11:13 PM
|
I have half of the solution to your problem. I'm hardtime to get the valuemember of my second box. The code is in VB with Acces DB. " Dim ds As New DataSet Dim cmdString As String = "select * from project" Dim da As New OleDb.OleDbDataAdapter(cmdString, con) da.Fill(ds, "project")
cmdString = " select * from group" da = New OleDb.OleDbDataAdapter(cmdString, con) da.Fill(ds, "group")
Dim relation As New DataRelation("ProjectGroup", _ ds.Tables("project").Columns("project_ID"), _ ds.Tables("group").Columns("project_ID") _ ) ds.Relations.Add(relation)
cb1.DataSource = ds cbOrg.DisplayMember = "tblProjectGroup.ProjectGroup_Name" cbOrg.ValueMember = "tblProjectGroup.ProjectGroup_ID"
cbAccount.DataSource = ds cbAccount.DisplayMember = "tblProjectGroup.ProjectGroup.Group_name" cbAccount.ValueMember = "tblProjectGroup.ProjectGroup.Group_ID" " I hope this will help you....
|
|
Reply By:
|
hemanth_p2p
|
Reply Date:
|
1/10/2006 1:23:24 AM
|
Thank you! that looks promising. Let me try it and see if i can get the data into the second one as well
----
Distributed computing ->Causality-> EventDriven ->We have the last laugh.!!
|