home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 March / PCWK0397.iso / novell / webserv3 / nws30.exe / DISK1 / NETBASIC / WEB / WEBORA4.BAS < prev    next >
BASIC Source File  |  1996-09-12  |  3KB  |  99 lines

  1.  
  2. Sub main
  3. DOC:HEADING("DATABASE QUERY ON EMP TABLE ")
  4. 'DOC:Body(DOC_RED,DOC_ORANGE)
  5.  
  6. ParamObj = DOC:Var
  7. If (ParamObj.Error != 0)
  8.    DOC:Print("An Error has occurred ",ParamObj.Error)
  9.    Return
  10. EndIf
  11.  
  12. Doc:Format(False)
  13.  
  14. Handle = ORA:Logon(ParamObj.User,ParamObj.password)
  15. If (Err != 0)
  16.    DOC:Heading("NDS Login")
  17.    DOC:Body(DOC_BLACK,DOC_RED,DOC_GOLD,DOC_BLACK)
  18.    CENTERON()
  19.    DOC:Print:H3("LOGON ERROR")
  20.    Err1 = SYS:Error:Number
  21.    Msg = ORA:error:Message(Err1)
  22.    DOC:Print:H3(Msg)
  23. 'If (Err = 0)
  24. Else
  25.    DOC:Print:H2("Query : ",ParamObj.Query); NewLine
  26.    DOC:Break
  27.    DOC:Tag:Begin("Pre")
  28.    Success = ORA:Query(ParamObj.Query)
  29.  
  30.    If (Success)
  31.          ORA:Record:Get
  32.          Buffer= ORA:field:First
  33.          eType=ORA:Field:Type
  34.          Bu = ORA:Field:Next
  35.          cType=ORA:Field:Type
  36.          Buf = ORA:Field:Next
  37.          Buff= ORA:Field:Next
  38.          Buffe = ORA:Field:Next
  39.          Buffe1 = ORA:Field:Next
  40.          Buffe2 = ORA:Field:Next
  41.          Buffe3 = ORA:Field:Next
  42.  
  43.       Size = ORA:Field:size
  44.       DOC:Print ("Field size of the current field is equal to ' ",Size," '")
  45.       Doc:Break
  46.  
  47.       DOC:Print(Buffer,"    ",Bu,"     ",Buf,"        ",Buff,"         ",Buffe, "        ","    ",Buffe1, "          ", Buffe2, "        ",Buffe3)
  48.       DOC:Break
  49.       DOC:Print("---------------------------------------------------------------------------------------------------")
  50.  
  51.       DOC:Break
  52.  
  53.       Count = 0
  54.       Do While (ORA:Record:Get)
  55.  
  56.          Empno= ORA:Field:Get("empno")
  57.          Ename= ORA:Field:Get("ename")
  58.          Job  = ORA:Field:Get("Job")
  59.          MGR = ORA:Field:Get("MGR")
  60.          HIREDATE = ORA:Field:Get("HIREDATE")
  61.          SAL = ORA:Field:Get("SAL")
  62.          COMM = ORA:Field:Get("COMM")
  63.          DEPTNO = ORA:Field:Get("DEPTNO")
  64.          happy= ORA:field:Max(10)
  65.          MS=DATA:String(eType)
  66.          DOC:Print(Empno)
  67.          DOC:Print("    ")
  68.          DOC:Print(STR:Sub(STR:Pad:Right(Ename,18),1,10))
  69.          DOC:Print(STR:Sub(STR:Pad:Right(Job,18),1,10))
  70.          DOC:Print("   ",MGR,"    ")
  71.          DOC:Print("   ",HIREDATE,"    ")
  72.          DOC:Print("   ",SAL,"    ")
  73.          DOC:Print("   ",COMM,"    ")
  74.          DOC:Print(DEPTNO)
  75.          DOC:Break
  76.          Count = Count + 1
  77.       EndDo
  78.       Doc:Print(Count," records retrieved")
  79.       'DOC:Print(cType)
  80.       'DOC:Print(eType)
  81.  
  82.       Else
  83.          Err1 = SYS:Error:Number
  84.          Msg = ORA:Error:Message(Err1)
  85.          DOC:Print(MSG)
  86.       'return
  87.    EndIf
  88.    ' DOC:Break
  89.    ' Doc:Print(Count," records retrieved")
  90.    Success = ORA:Logoff(Handle)
  91.  
  92. EndIf
  93.  
  94. DOC:Tag:End("Pre")
  95.  
  96. End Sub
  97.  
  98.  
  99.