Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle Data Control

Re: Oracle Data Control

From: TurkBear <johng_at_mm.com>
Date: 1998/03/27
Message-ID: <351c15a7.20410318@news2.mm.com>#1/1

I have used Oracle Objects ( OO40) - it in an application used to bring up a list of 5000 employees - it also allows for ad-hoc selection of a subset -

I just used the Oracle Data grid, and Oracle Data Control instead of the MS ones -

Here is my source code - edited to remove sensitive stuff ( username,passowrds, etc) - for the dataset creation stuff.



Const Err$ = "Error not specified"
Const WarnLastEmp$ = "This is the Last Name" Const WarnFirstEmp$ = "This is the First Name" Const
GetIt$="selectempl_nm,empl_nbr,job_desc,empl_stat_desc,dept_nbr,dept_nm from hr_cur_rptng where empl_stat_cd = 'A' order by empl_nm" Dim OraSession As Object
Dim OraDatabase As Object
Dim OraDynaset As Object

Private Sub Command1_Click()
OraDynaset.DbMoveNext
  If OraDynaset.EOF = True Then
   MsgBox WarnLastEmp$
   OraDynaset.DbMoveLast
  End If  

 Call DataRefresh

End Sub

Private Sub Command2_Click()
 OraDynaset.DbMovePrevious  

  If OraDynaset.BOF = True Then
   MsgBox WarnFirstEmp$
   OraDynaset.DbMoveFirst
  End If  

 Call DataRefresh

End Sub

Private Sub Command3_Click()
Unload Form1
End
End Sub

Private Sub Command4_Click()
Dim SingleQuote As String
Dim FindClause As String

ErrMsg = ""
SingleQuote = "'"
On Error GoTo err_find
FindClause = "empl_nm like " & SingleQuote & txtFind & "%" & SingleQuote
OraDynaset.DbFindFirst FindClause

If OraDynaset.NoMatch Then
  MsgBox "Could not find record matching your criteria"   OraDynaset.MoveFirst
End If

Call DataRefresh

Exit Sub

err_find:
  If ErrMsg <> "" Then

     MsgBox ErrMsg
    Else
     MsgBox Error$
    End If     

End Sub

Public Sub DataRefresh()     

  If (OraDynaset.BOF <> True And OraDynaset.EOF <> True) Then   Txtenum = OraDynaset.Fields("empl_nbr").Value   

  ' we can't display nulls, so display "" for NULL fields   If Not IsNull(OraDynaset.Fields("empl_nm").Value) Then     txtname = OraDynaset.Fields("empl_nm").Value     Else
    txtname = ""
    End If     

  If Not IsNull(OraDynaset.Fields("job_desc").Value) Then     txtTitle = OraDynaset.Fields("job_desc").Value

    Else
    txtTitle = ""
    End If     

  If Not IsNull(OraDynaset.Fields("empl_stat_desc").Value) Then    txtStat = OraDynaset.Fields("empl_stat_desc").Value    Else
   txtStat = ""
   End If   

   If Not IsNull(OraDynaset.Fields("Dept_nm").Value) Then    TxtDptnm = OraDynaset.Fields("Dept_nm").Value    Else
   TxtDptnm = ""
   End If    

    If Not IsNull(OraDynaset.Fields("dept_nbr").Value) Then    TxtDeptNbr = OraDynaset.Fields("dept_nbr").Value    Else
   TxtDeptNbr = ""
   End If   

'if the current dynaset row is invalid, display nothing  Else

  txtEmpno = ""
  txtname = ""
  txtTitle = ""
  txtStat = ""

  TxtDeptNbr = ""
  TxtDptnm = ""   

 End If

End Sub

Public Sub SetSess()
Set OraSession = CreateObject("OracleInProcServer.XOraSession") Set OraDatabase = OraSession.DbOpenDatabase("hro1", "UIDremoved/PWRemoved", 0&)
Set OraDynaset = OraDatabase.DbCreateDynaset(GetIt$, 0&) OraDynaset.DbMoveFirst
Form2.Refresh
End Sub


While the formatting copied badly, it should give some ideas about using the Objects for Oracle

John Greco
Oracle DBA
MnDOT

"Mike Lacey" <Mike_Lacey_at_Cargill.Com> wrote:

>Good Luck - I have never used the Oracle data control (presume you mean the
>one that comes with Oracle Objects for OLE) with VB5 successfully.
>
>If you manage it I'd like to know how.
>
>Regards
>
>Mike
>
>
>Phillip J. Sloan wrote in message <351ac785.183823954_at_152.51.20.123>...
>>I am using Oracle data controls in a VB 5 application. When I build
>>the setup program and try to run it I get:
>>
>>Run time error '-2147417848 (80010108)': Automation Error.
>>
>>Does anyone have any suggestions? This occurs when I try to load a
>>form containing an Oracle data control.
>>
>
>
>
Received on Fri Mar 27 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US