Este es el codigo que he utilizado:
Código: |
|
Para poder aprender hacer esto la información la he conseguido en:
http://alevel-computing.x10.mx/mw/index.php/Lazarus
Código: |
|
SQLite3Connection1.Database:='student.dbDon't forget you need 'student.db' and 'sqlite3.dll' in the same folder as your project.
SQLite3Connection1.Connect:=true;
'SELECT * FROM Student WHERE First like "M%"
'INSERT INTO Student VALUES (244, 'Charlie','Chaplin','13We'"which will pick out everyone whose first name begins with 'M' or add the comedian to the database. Code
SQLite3Connection1.Database:='student.dbDon't forget you need 'student.db' and 'sqlite3.dll' in the same folder as your project.
SQLite3Connection1.Connect:=true;
Tutorial | Uses | Resources | SQL | Purpose |
---|---|---|---|---|
Connect | SQLite3Connection | Student.db | Student.txt | To get a basic connection |
DBGrid and DBNavigator | SQLTransacction, SQLQuery, DataSource, DBGrid, DBNavigator | Student.db | Student.txt | To show DBNavigator working |
DBEdit | DBEdit | Student.db | Student.txt | To show DBEdits in action |
DBMemo | DBMemo, DBImage | Student.db, Sounds folder, Details folder, Pictures folder | Student.txt | Multimedia database |
SQL | StringGrid, Memo | Student.db | Student.txt | Using SELECT and INSERT commands directly |
Multiple tables | Student2.db | Student2.txt | Using 4 related tables in your program | |
Buttons | Locate() | Student.db | Student.txt | How to implemet the database without DBNavigator |
LazReport | Student.db, LazReport package frDBDataSet, frReport | Student.txt | How to make a table look good |
Código: |
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} uses Unit2; procedure TForm1.Button1Click(Sender: TObject); begin Edit1.Text := ReverseString(Edit1.Text); end; end. |
Código: |
unit Unit2; interface // Cabecera de Funciones y Procedimientos de Unit2 visibles en otras unidades implementation uses Unit1; // Referencia a Unit1 // Implementación de Funciones y Procedimientos de Unit2 (Internas y Externas) end. |
Código: |
unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { private declarations } public { public declarations } end; var Form1: TForm1; implementation {$R *.lfm} uses Unit2; { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin TForm2.ShowForm; end; end. |
Código: |
unit Unit2; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls; type { TForm2 } TForm2 = class(TForm) Timer1: TTimer; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { private declarations } public class procedure ShowForm; end; var Form2: TForm2; implementation {$R *.lfm} procedure TForm2.FormCreate(Sender: TObject); begin Timer1.Enabled := False; //Iniciomaos el timer primero lo ponemos a 0 Timer1.Interval := 2000; //los milisegundos a los que saltara el timer Timer1.Enabled := True; //lo iniciamos. end; procedure TForm2.FormDestroy(Sender: TObject); begin Form2 := nil; end; procedure TForm2.Timer1Timer(Sender: TObject); begin close; //Cuando pasa el tiempo estipulado en el timer //ejecuta lo de esta función. end; class procedure TForm2.ShowForm; begin if not Assigned(Form2) then Form2 := TForm2.Create(nil); Form2.Show; // o ShowModal end; end. |