Einzelnen Beitrag anzeigen

Benutzerbild von Seppel
Seppel

Registriert seit: 14. Jun 2005
139 Beiträge
 
#47

Re: Access Tabelle durchsuchen

  Alt 29. Nov 2007, 13:43
ok.
Ich post ma alles rein:
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBTables, Grids, DBGrids, DBClient, StdCtrls, DBCtrls, ExtCtrls,
  Mask, DBCGrids, ADODB;

type
  TForm1 = class(TForm)
    DataSource1: TDataSource;
    Label1: TLabel;
    Label2: TLabel;
    name: TDBEdit;
    Rasse: TDBEdit;
    p1: TDBEdit;
    p2: TDBEdit;
    p3: TDBEdit;
    m1: TDBEdit;
    m2: TDBEdit;
    m3: TDBEdit;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    komm: TDBMemo;
    Label11: TLabel;
    id: TDBEdit;
    DBNavigator1: TDBNavigator;
    Button1: TButton;
    ADOConnection1: TADOConnection;
    Table1: TADOTable;
    Query1: TADOQuery;
    DBEdit1: TDBEdit;
    Table1ID: TAutoIncField;
    Table1STUID: TIntegerField;
    Table1Name: TWideStringField;
    Table1Rasse: TWideStringField;
    Table1Planet1: TWideStringField;
    Table1Planet2: TWideStringField;
    Table1Planet3: TWideStringField;
    Table1Mond1: TWideStringField;
    Table1Mond2: TWideStringField;
    Table1Mond3: TWideStringField;
    Table1Kommentar: TWideStringField;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
 
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.Button1Click(Sender: TObject);
begin
//Query1.SQL.Text := 'SELECT * FROM apezdb WHERE STUID = :stuid';
Query1.Locate('apezdb;',id.Text,[loPartialKey]);
//Query1.SQL.Text := 'SELECT * FROM apezdb WHERE STUID ='+id.Text;
//Query1.ParamCheck := true;
//Query1.ParamByName('stuid').AsInteger := StrToInt(id.Text);
Query1.Open;


DBedit1.Clear;
id.Clear;
name.Clear;
Rasse.clear;p1.Clear;p2.Clear;p3.Clear;m1.Clear;
m2.Clear;m3.Clear;komm.Clear;


Dbedit1.Text := Query1.FieldByName('ID').asString;
id.text := Query1.FieldByName('STUID').asString;
name.Text := Query1.FieldByName('Name').asString;
Rasse.Text := Query1.FieldByName('Rasse').asString;
p1.Text := Query1.FieldByName('Planet1').asString;
p2.Text := Query1.FieldByName('Planet2').asString;
p3.Text := Query1.FieldByName('Planet3').asString;
m1.Text := Query1.FieldByName('Mond1').asString;
m2.Text := Query1.FieldByName('Mond2').asString;
m3.Text := Query1.FieldByName('Mond3').asString;
komm.Text := Query1.FieldByName('Kommentar').asString;


end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Query1.SQL.Text := 'SELECT * FROM apezdb';
Query1.Open;

Dbedit1.Text := Query1.FieldByName('ID').asString;
id.text := Query1.FieldByName('STUID').asString;
name.Text := Query1.FieldByName('Name').asString;
Rasse.Text := Query1.FieldByName('Rasse').asString;
p1.Text := Query1.FieldByName('Planet1').asString;
p2.Text := Query1.FieldByName('Planet2').asString;
p3.Text := Query1.FieldByName('Planet3').asString;
m1.Text := Query1.FieldByName('Mond1').asString;
m2.Text := Query1.FieldByName('Mond2').asString;
m3.Text := Query1.FieldByName('Mond3').asString;
komm.Text := Query1.FieldByName('Kommentar').asString;
end;

end.
Sebastian
www.seppel.de.pn
  Mit Zitat antworten Zitat