Recent

Author Topic: Motorola MC3090 + sqlite  (Read 1936 times)

MrGruffi

  • Newbie
  • Posts: 1
Motorola MC3090 + sqlite
« on: June 29, 2018, 03:07:34 pm »
Hello,
I'm trying connect to SQLite database for WinCE, compiles the program in Typhon.
I downloaded the dll library for wince but when i run the program I get message "TApplication.HandleException Connect1 : no such table: nuser".
When I run the same program on windows 32 bit work fine.
Could you help  me whot I do wrong.
Here is my source code:
Code: Pascal  [Select]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, sqlite3conn, sqldblib, sqldb, FileUtil, Forms,
  9.   Controls, Graphics, Dialogs, StdCtrls;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     Button1: TButton;
  17.     Button2: TButton;
  18.     Edit1: TEdit;
  19.     Edit2: TEdit;
  20.     Label1: TLabel;
  21.     Label2: TLabel;
  22.     SQLDBLibraryLoader1: TSQLDBLibraryLoader;
  23.     Connect1: TSQLite3Connection;
  24.     SQLQuery1: TSQLQuery;
  25.     SQLTrans1: TSQLTransaction;
  26.     procedure Button1Click(Sender: TObject);
  27.     procedure Button2Click(Sender: TObject);
  28.     procedure FormCreate(Sender: TObject);
  29.   private
  30.  
  31.   public
  32.  
  33.   end;
  34.  
  35. var
  36.   Form1: TForm1;
  37.  
  38. implementation
  39.  
  40. {$R *.frm}
  41.  
  42. { TForm1 }
  43.  
  44. procedure TForm1.FormCreate(Sender: TObject);
  45. begin
  46.    SetBounds(0,22,Screen.Width,Screen.Height);
  47.  
  48.   try
  49.     SQLDBLibraryLoader1.ConnectionType:= 'SQLite3';
  50.      SQLDBLibraryLoader1.LibraryName:= 'sqlite3.dll';
  51.     SQLDBLibraryLoader1.Enabled:= True;
  52.   except
  53.     Label1.Caption:= 'sqlite3.dll fault';
  54.   end;
  55. end;
  56.  
  57. procedure TForm1.Button2Click(Sender: TObject);
  58. begin
  59.   Application.Terminate;
  60. end;
  61.  
  62. procedure TForm1.Button1Click(Sender: TObject);
  63. begin
  64.   begin
  65.       Connect1.DatabaseName:= 'test.db';
  66.       Connect1.Connected:= True;
  67.       SQLQuery1.SQL.Clear;
  68.       if FileExists('bazatest.db') then
  69.          begin
  70.  
  71.             SQLQuery1.SQL.Clear;
  72.             SQLQuery1.SQL.Add('insert into nuser(id, imie) values (:id_e, :name_e)');
  73.             SQLQuery1.Params.paramByName('id_e').AsString := Edit1.Text;
  74.             SQLQuery1.Params.paramByName('name_e').AsString := Edit2.Text;
  75.             SQLQuery1.ExecSQL;
  76.             SQLTrans1.Active:= True;
  77.             SQLTrans1.Commit;
  78.  
  79.             SQLQuery1.Close;
  80.  
  81.  
  82.       end else
  83.       begin
  84.         ShowMessage('fault!');
  85.       end;
  86.   end;
  87. end;
  88.  
  89. end.
  90.  

I don't know whot is wrong :(
Could you help me Guys, please.

bambamns

  • Full Member
  • ***
  • Posts: 218
Re: Motorola MC3090 + sqlite
« Reply #1 on: October 06, 2018, 12:02:34 pm »
Hi,

First , AFAIK you need to proivde full path on WinCE for database.

Second , why do you use SQLDBLibraryLoader ?

Third , you are connecting to Connect1.DatabaseName:= 'test.db'; and after you search for if FileExists('bazatest.db') - test.db and bazatest.db are not the same file.

Fourth , do you use sqlite3.dll for wince ?

And last - I have tried to use Typhon several times for WinCe and run to lot of problems so I still use plain Lazarus + cross arm wince addon (still with fpc 2.6.4).
Lazarus 1.4.4 + FPC 2.6.4 x86 (rebuild), Windows 7 x64, unless otherwise specified

Iwoks

  • Newbie
  • Posts: 2
Re: Motorola MC3090 + sqlite
« Reply #2 on: November 02, 2018, 04:14:02 pm »
Hay!

If you using a arm-wince
  Take sqlite3.dll for wince and paste this file in your .exe directory.
  http://www.iwoks.net/download/sqlite3.dll

I use this lpk for sqlite3
  http://www.iwoks.net/download/SQLite3.zip

Best regard.

Thaddy

  • Hero Member
  • *****
  • Posts: 7195
Re: Motorola MC3090 + sqlite
« Reply #3 on: November 02, 2018, 07:27:12 pm »
Hay!

If you using a arm-wince
  Take sqlite3.dll for wince and paste this file in your .exe directory.
  http://www.iwoks.net/download/sqlite3.dll

I use this lpk for sqlite3
  http://www.iwoks.net/download/SQLite3.zip

Best regard.
There is no single dll for wince. It depends on the platform: arm - even the correct architecture - , intel, mips.... make sure you have a correct one or compile it yourself. sqlite3 is easy to compile even for noobs.
« Last Edit: November 02, 2018, 07:28:51 pm by Thaddy »
inline variables like in D10.3 are a bit like Brexit: if you are given the wrong information it sounds like a good idea. Every kid loves candy, but it makes you fat and your teeth will disappear.