Lazarus实战开发之数据库SQLite(WIN32/WINCE)

本文来自http://blog.csdn.net/hellogv/
SQLite是一个轻量级的嵌入式数据库,在PC上大可不用它,但是在WINCE上,他就起很大作用了(ACCESS在WINCE上停止升级,SQL CE又太庞大)。
  • 在Lazarus for WIN32上使用SQLite
  1. 安装SQLite for WIN32: VC2005编译SQLite, http://blog.csdn.net/hellogv/archive/2008/05/06/2399700.aspx ,把编译后的sqlite3.dll放在Windows系统文件夹之下;也可以直接到 www.sqlite.org下载现有的sqlite3.dll。
  2. 安装LAZARUS的SQLite控件:\lazarus\components\sqlite\sqlite3laz.lpk
在WIN32编写好SQLite数据库程序,然后修改编译器,从而生成WINCE平台下的数据库程序,这样可以大大减少交叉编译~调试所浪费的时间!
  • 在Lazarus for WINCE上使用SQLite
  1. 编译得到SQLite3.dll for wince
  2. 先进LAZARUS Application工程,添加SQLITE3DATASET控件
  3. 您必须先设定项目的编译器属性,请点选选单项目: Project > Compiler options...,点选Path分页,并把LCL Widget改编为Wince;点选Code分页,并把target platform改变为arm-wince。
  4. 编译时会提出Fatal: Can't find unit PropEdits used by registersqlite3 这样的错误,这时就需要修改\lazarus\components\sqlite\registersqlite3.pas的代码
  5. 把PropEdits,ComponentEditors,SqliteComponentEditor 注释掉; 把RegisterComponentEditor(TSqlite3Dataset,TSqliteEditor) ; RegisterPropertyEditor(TypeInfo(String),TSqlite3Dataset,'FileName',TFileNamePropertyEditor);注释掉
  6. 重新编译即可通过。
附:使用DBGrid等一小部分数据敏感控件时,即使编译通过,但是在WINCE上运行还是会提出“Access violation ”这类错误,DBEDIT等其他数据敏感控件则可以正常使用!

    你可能感兴趣的:(.net,sqlite,嵌入式,Access,WinCE)