Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> OO4O and vb5 dbcombo problem
I have a problem with
Microsoft Visual Basic 5.0's dbcombo
and
Oracle Objects for OLE Version 2.2 (Oracle 8.0.4)
Following is a sample program.
All seems to work fine, but when
the user selects dbcombo1's first item,
then dbcombo2 doesn't show what it should.
Where's the problem? Can anybody help me? Thanks in advance.
'controls:
'oradc1 (oradc).......... cities
'oradc2 (oradc).......... states
'text1 (textbox)......... shows city.state_id
'dbcombo1 (dbcombo)...... shows state.code
'dbcombo2 (dbcombo)...... shows state.name
'design time settings:
'text1.DataSource ...... ORADC1
'dbcombo1.DataSource ... ORADC1
'dbcombo1.RowSource .... ORADC2
'dbcombo2.DataSource ... ORADC1
'dbcombo2.RowSource .... ORADC2
Dim s As Object 'session Dim db As Object 'database Dim dy1 As Object 'cities dynaset Dim dy2 As Object 'states dynaset
Const ORADB_ORAMODE = &H1&
Const ORADB_NOWAIT = &H2&
Private Sub Form_Load()
Set s = CreateObject("OracleInProcServer.XOraSession")
Set db = s.OpenDatabase("my_service", "system/manager", ORADB_ORAMODE
Or ORADB_NOWAIT)
Set dy1 = db.DBCreateDynaset("select * from city", 0&)
Set dy2 = db.DBCreateDynaset("select * from state", 0&)
s.begintrans
Set ORADC1.Recordset = dy1
Set ORADC2.Recordset = dy2
Text1.DataField = "state_id" 'en dy1
DBCombo1.DataField = "state_id" 'en dy1 DBCombo2.DataField = "state_id" 'en dy1
DBCombo1.ListField = "code" 'en dy2
DBCombo2.ListField = "name" 'en dy2
DBCombo1.BoundColumn = "state_id" 'en dy2 DBCombo2.BoundColumn = "state_id" 'en dy2 End Sub
Private Sub Form_Unload(Cancel As Integer)
s.rollback
End Sub
Private Sub DBCombo1_GotFocus()
Focused = DBCombo1.Name
End Sub
Private Sub DBCombo2_GotFocus()
Focused = DBCombo2.Name
End Sub
Private Sub DBCombo1_Click(Area As Integer) If Focused = DBCombo1.Name Then
DBCombo2.BoundText = DBCombo1.BoundText
Text1.Text = DBCombo1.BoundText
End If
End Sub
Private Sub DBCombo2_Click(Area As Integer) If Focused = DBCombo2.Name Then
DBCombo1.BoundText = DBCombo2.BoundText
Text1.Text = DBCombo2.BoundText
End If
End Sub
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Nov 09 1999 - 08:10:58 CST
![]() |
![]() |