|
-
Sep 10th, 2001, 04:07 AM
#1
Thread Starter
Addicted Member
Run-Time bindings - nightmare
Hello vb-world fans !
I am moving slowly through ADO and I ran to a problem I already had once but @ that time I didn't care about it and did a workaround. But now I want to solve it. Soooo ....
I have a combo -> User selects a record -> BoundText returns ID and I want to display the respective records in another combo. Doesn't look hard, does it? /Let's use a simple example: In one combo you have all surnames and when you select for example Moore it will populate the other combo with Karl, Peter, Josh etc./
I have created a command that selects the records from the table and I thought that when I just add the WHERE clause to the commandtext at run-time it will work. But oh ah ...
When I set the command text to the new value "SELECT ... WHERE ..." nothing happens and combo stays empty. Even after changing the commandtext I rebind the combo -> no change.
So ... looks simple to me but I can't figure it out.
Anybody?
TIA.
-
Sep 10th, 2001, 05:54 AM
#2
-= B u g S l a y e r =-
could u show the code where u have trouble?
-
Sep 10th, 2001, 06:13 AM
#3
Thread Starter
Addicted Member
Sure but before I do that it might be more simple if you could just give me a "walkthrough"
Maybe I am doing something wrong. I am using ADO ComboBox which I have binded to DataEnvironment and One of its commands in design time. This Combo works fine. Then I have another combo which is being binded @ run-time. However I am just guessing here how to bind it.
Ok, here is the code:
PEOPLE_LEFT and PEOPLE_RIGHT are constatnts that define the SQL ("SELECT Sn+','+Fn AS FullName FROM Names WHERE OrID=.... ORDER BY FullName")
VB Code:
If dbcboOrg.MatchedWithList Then
Set newCOM = New ADODB.Command
newCOM.CommandText = _
PEOPLE_LEFT & _
dbcboOrg.BoundText & ")" _
& PEOPLE_RIGHT
Set newCOM.ActiveConnection = deZakLis.cnDBZakLis
newCOM.CommandType = adCmdTable
newCOM.Prepared = True
dbcboLudia.RowMember = newCOM.Name
dbcboLudia.ListField = "FullName"
dbcboLudia.ReFill
dbcboLudia.Visible = True
dbcboLudia.SetFocus
....
Hope it is clear. Before using newCOM I tried using a command that was created in the DataEnvironment but when I changed it's commandtext it showed no results.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|