Advertisement
Dalacul

VisualFox diverse

Oct 12th, 2018
3,408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Obs:
  2. Comenziile de creare a tabelelor nu se plaseaza in acelasi loc cu comenzile care adauga inregisrari in tabela, deoarece comanda de creare suprascrie tabelele respectiva
  3.  
  4. Sortare:
  5. Select* from elevi order by inaltime desc
  6.  
  7. creare.prg :
  8. CREATE TABLE elevi (cod N(3), nume C(30), datan D, med N(5.2), rezultat L)
  9. USE elevi
  10. BROWSE
  11. use
  12.  
  13. populare.prg :
  14. SET PATH TO "E:\\12C"
  15. CLEAR
  16. SET TALK OFF
  17. SET DATE TO DMY
  18. SET CENTURY ON
  19. USE elevi
  20. INPUT "Dati numar inregistrari: " TO n
  21. FOR i=1 TO n
  22.     vcod = 0
  23.     vnume = ""
  24.     vdatan = {}
  25.     vmed = 0.0
  26.     vrezultat = .F.
  27.     INPUT "COD = " TO vcod
  28.     ACCEPT "NUME = " TO vnume
  29.     INPUT "DATA NASTERII = " TO vdatan
  30.     INPUT "MEDIA = " TO vmed
  31.     INPUT "REZULTAT = " to vrezultat
  32.     APPEND BLANK
  33.     replace cod WITH vcod, nume WITH vnume, datan WITH vdatan, med WITH vmed, rezultat WITH vrezultat
  34. ENDFOR
  35. use
  36.  
  37. aplicatie.prg :
  38. close all
  39. use elevi
  40. CLEAR
  41. ?"Introduceti operatia dorita:"
  42. ?"1 - introducerea a n inregistrari"
  43. ?"2 - afisarea inregistrarilor elevilor clasei date"
  44. ?"3 - afisarea unui elev dupa numarul inregistrarii"
  45. ?"4 - afisarea unui elev dupa numarul matricol"
  46. ?"5 - stergerea unui elev dupa nume"
  47. ?"6 - modificarea datelor unui elev dupa nume"
  48. input to op
  49. if(op==1)
  50.     do populare
  51. endif
  52. if(op==2)
  53.     input "Dati numarul clasei: " to vclasa
  54.     browse for clasa = vclasa
  55. endif
  56. if(op==3)
  57.     input "Dati numarul inregistrarii: " to vnumar
  58.     browse for recno() = vnumar
  59. endif
  60. if(op==4)
  61.     input "Dati numarul matricol: " to vmatricol
  62.     browse for matricol = vmatricol
  63. endif
  64. if(op==5)
  65.     accept "Dati numele elevului: " to vnume
  66.     delete for nume = vnume
  67.     pack
  68. endif
  69. if(op==6)
  70.     accept "Dati numele elevului: " to vnume
  71.     locate for nume = vnume
  72.     input "Dati noua clasa: " to vnouclasa
  73.     input "Dati noul matricol: " to vnoumatricol
  74.     accept "Dati noua adresa: " to vnouadresa
  75.     replace clasa with vnouclasa, matricol with vnoumatricol, adresa with vnouadresa, nume with vnume
  76. endif
  77. use
  78.  
  79. transfer:
  80. SET TALK OFF
  81. CLEAR
  82. CLOSE ALL
  83. SELECT 1
  84. USE elevi
  85. SELECT 2
  86. USE respinsi
  87. select 1
  88. SCAN
  89. vcod = cod
  90. vnume = nume
  91. vmed = med
  92. vrez = rez
  93. IF vrez=.F.
  94.     ?"sterg " + vnume
  95.     SELECT 2
  96.     APPEND BLANK
  97.     replace cod WITH vcod, med WITH vmed, rez WITH vrez
  98.     SELECT 1
  99. ENDIF
  100. ENDSCAN
  101. DELETE FOR vrez=.F.
  102. PACK
  103. USE
  104. SELECT 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement