
In questa sezione troverete i comandi pių utilizzati e spesso introvabili per eseguire varie operazioni sui Database
| Ritorna alla Home Page
|
| Cercare una determinata data |
| ricerca = DTPicker1.Value Data2.RecordSource = "select * from PERDITE where PERDITE.Data = #" & Format$(CDate(ricerca), "mm/dd/yy") & "#" Data2.Refresh |
| Selezionare un intervallo di date |
| Private Sub Command4_Click() Data1.RecordSource = "select * from PRODUZIONE where PRODUZIONE.Data >=#" & Format$(CDate(DTPicker2.Value), "mm/dd/yy") & "# and PRODUZIONE.Data <=#" _ & Format$(CDate(DTPicker3.Value), "mm/dd/yy") & "#" Data1.Refresh End Sub In questo esempio č stato utilizzato un command button e due dtpicker.Al posto dei dtpicker possiamo inserire qualsiasi variabile purchč sia una data. |
| Eseguire ricerche in un database (es. :Text1.text =631 visualizza tutti i record dove BOLLA incomincia con 631) |
| Text1.text=RICERCA Data1.RecordSource = " select * from RIPARAZIONI where BOLLA LIKE '" & RICERCA & "*'" Data1.Refresh |
| Ordinare un database (es.: ordina il database riferito alla colonna Tipo crescente "A to Z") |
| Data1.RecordSource = " select * from RIPARAZIONI order by
Tipo " Data1.Refresh |
| Ordinare un database "decrescente" (es.: ordina il database riferito alla colonna Tipo decrescente " Z to A") |
| Data1.RecordSource = " select * from RIPARAZIONI order by
Tipo desc " Data1.Refresh |
| Stampare i record di un database (stampa ,in questo caso, tutti i record della tabella ) |
| Data1.Recordset.MoveFirst For i = 1 To Data1.Recordset.RecordCount a = a & Data1.Recordset.Fields(1) & " " & Data1.Recordset.Fields(2) & " " & Data1.Recordset.Fields(3) & Chr$(13) Data1.Recordset.MoveNext Next i Printer.Print a Printer.EndDoc |