Recent

Author Topic: sqlite - list index (-1) out of bounds  (Read 5418 times)

pumuckl

  • Newbie
  • Posts: 2
sqlite - list index (-1) out of bounds
« on: May 02, 2007, 10:45:17 am »
Hey,

I want to connect to a sqlite database! I use Sqlite3dataset1, Datasource1 (Dataset = Sqlite3dataset) & DBGrid1(Datasource = Datasource1).

Then I start the application and press the button1 I get the errormessage
Code: [Select]

list index (-1) out of bounds


by the way: the code below works on windows!

I found already a hint in this forum to use EXECSQL instead of OPEN, but it doesn't help.

Code: [Select]
unit unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  sqlite3ds, db, DBGrids, Buttons, odbcconn;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    CheckGroup1: TCheckGroup;
    Datasource1: TDatasource;
    DBGrid1: TDBGrid;
    ODBCConnection1: TODBCConnection;
    Sqlite3Dataset1: TSqlite3Dataset;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
   Sqlite3Dataset1.FileName:='/home/Koschi/Computer/progs/Lazarus/001-Test/fina2.db';
   Sqlite3Dataset1.TableName:='finanzen';
//   Sqlite3Dataset1.Sql:='SELECT * FROM finanzen';
//   Sqlite3Dataset1.execsql;
   Sqlite3Dataset1.open;

end;

initialization
  {$I unit1.lrs}

end.


If I run the code with

Code: [Select]

   Sqlite3Dataset1.Sql:='SELECT * FROM finanzen';
   Sqlite3Dataset1.execsql;
// Sqlite3Dataset1.open;

 
i get the errormessage
Code: [Select]

   Sqlite3Dataset : SQLITE_ERROR - unsupported file format


but as I already mentioned it works fine on windows.

Thanks!

Metainfo: Linux 10.1.; Lazarus 0.9.22 b; FPC 2.0.4; Sqlite 3

pumuckl

  • Newbie
  • Posts: 2
sqlite - list index (-1) out of bounds
« Reply #1 on: May 02, 2007, 09:52:46 pm »
I solved it! The Database was created on windows with sqliteanalyzer, which seems to be not compatible to sqlite 3.2.8 and sqlite3.so in Lazarus! The database could not opened there.

Now I'm using sqliteman (sqliteman-0.99-20070421 on windows and linux) and everything works fine!

Thanks!

 

TinyPortal © 2005-2018