Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

lazarus pomoć oko grida

[es] :: Pascal / Delphi / Kylix :: lazarus pomoć oko grida

[ Pregleda: 1538 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

MarkoBalkan

Član broj: 141124
Poruke: 1624
178.160.22.*



+19 Profil

icon lazarus pomoć oko grida30.07.2011. u 17:30 - pre 154 meseci

ovo je code ,problem mi stvara dio za punjenje grida

ds.DataSet:=query;
DBGrid1.DataSource:=ds;

dobijem poruku: project project1 raised exception class External SIGSEGV

Code:

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  DBGrids, DbCtrls, Grids, sqldb, postgres, pqconnection,db;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    DBGrid1: TDBGrid;
    Memo1: TMemo;

    procedure Button1Click(Sender: TObject);
  private
    conn : TPQConnection;
    query : TSQLQuery;
    transaction : TSQLTransaction;
     dt : TDataSet;
     ds : TDatasource;

  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
  S: String;

begin
  conn := TPQConnection.Create(nil);
  query := TSQLQuery.Create(nil);
  transaction := TSQLTransaction.Create(nil);
  try
    try
      conn.HostName := '127.0.0.1';
      conn.UserName := 'postgres';
      conn.Password := 'postgres';
      conn.DatabaseName := 'postgres';
      conn.Connected := True;
      conn.Transaction := transaction;
      query.DataBase := conn;
      //query.ParseSQL := true; //line not needed - this is the default anyway
      //query.ReadOnly := false; //line not needed - this is the default anyway
      query.SQL.Text := 'select * from proba';
    //  query.Open;

   //   query.Last;
    //  S := IntToStr(query.RecordCount) + #13#10;
  //    query.First;

  //    while not query.EOF do
  //    begin
  //      S := S + query.FieldByName('prva').AsString + #13#10;
  //      query.Next;
  //    end;
        begin
    //    query.open;

            ds.DataSet:=query;
             DBGrid1.DataSource:=ds;
   //    query.close;
      end ;

    finally
      query.Free;
      conn.Free;
    end;
  except
    on E: Exception do
      ShowMessage(E.message);
  end;
  Memo1.Text:= S;


end;

end.


 
Odgovor na temu

MarkoBalkan

Član broj: 141124
Poruke: 1624
178.160.22.*



+19 Profil

icon Re: lazarus pomoć oko grida30.07.2011. u 18:32 - pre 154 meseci
ako aplikaciju pokrenem izvan lazarusa dobijem slijedeću poruku na klik na button.

ako maknem onaj dio za datagrid, onda app radi.
Prikačeni fajlovi
 
Odgovor na temu

MarkoBalkan

Član broj: 141124
Poruke: 1624
178.160.90.*



+19 Profil

icon Re: lazarus pomoć oko grida31.07.2011. u 13:21 - pre 154 meseci
riješeno
 
Odgovor na temu

[es] :: Pascal / Delphi / Kylix :: lazarus pomoć oko grida

[ Pregleda: 1538 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.