I am using lazarus 0.9.10 with FBLIB component under win2k,a lazarus / 16-Databases ---------------------------------------------------------------------- Anonymous · 2006-04-05 09:25 I am using lazarus 0.9.10 with FBLIB component under win2k,and firebird1.5.3 database server was installed. Using FBLIB Library,I can create a new firebird database in following code: (The corresponing properties such as 'user' and 'password' were set at design time) Code: [Select]  TForm1 = class(TForm)   ...   FBLDatabase1: TFBLDatabase;   ...   procedure TForm1.FormCreate(Sender: TObject);   var   DB : string;   begin     DB := 'd:\lazarus\dbprojects\test.fdb';     FBLDatabase1.CreateDatabase(DB,'sysdba','masterkey',3,4096,'NONE');   end;   Now I wonder that if I can do the same thing by using zeos component set?   The reason I ask this is because that I would write a DB application to do things such as creating new database/table,maintaining the structure of tables,editing records in a dbgrid,etc.But there is no TTable component in the FBLIB Library.The zeos component set comes with a TZTable component,but I don't know how to create a new firebird database by using it. ---------------------------------------------------------------------- matthijs · 2006-04-05 10:28 If you can create a database with ZEOS components I do not know. But ... You can always use a TQuery component. With TQuery you can do the lot, display data, edit data, remove records. TTable is a relic left over from the good old Delphi1 and BDE days. ---------------------------------------------------------------------- Anonymous · 2006-04-07 03:24 I read these files:ZPlainInterbaseDriver.pas,ZPlainFirebird15.pas, ZPlainloader.pas,and the document Apiguide.pdf (http://www.ibphoenix.com/downloads/60ApiGuide.zip), so I made a test application as following: Code: [Select]unit fbtest; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,   Buttons, Menus, EditBtn, ComCtrls, DBCtrls, DBGrids, DB, sqldb,   ZDataset, ZConnection, ZSqlProcessor, ZSqlMonitor, ZSequence,   ZPlainFirebird15, ZPlainInterbaseDriver, windows; type   { TForm1 }   TForm1 = class(TForm)   ...   BtnCreateNewDataBase : TButton;   procedure BtnCreateNewDataBaseClick(Sender: TObject);   ... var   Form1: TForm1; implementation ... procedure TForm1.BtnCreateNewDataBaseClick(Sender: TObject); var status_vector : PISC_STATUS; db_handle : TISC_DB_HANDLE; tran_handle : TISC_TR_HANDLE; statement : string; begin   statement := 'CREATE DATABASE ''C:\mydb\test.fdb'' PAGE_SIZE 4096 USER ''SYSDBA'' PASSWORD ''masterkey'';';   isc_dsql_execute_immediate := Tisc_dsql_execute_immediate(GetProcAdd ress(LoadLibrary('C:\FireBird15\bin\fbclient.dll'),'isc_dsql_execute_i mmediate'));   db_handle := nil;   tran_handle := nil;   isc_dsql_execute_immediate(status_vector,@db_handle,@tran_handle,0,P Char(statement),3,nil); end; The application was compiled and can be run,but when I click on the BtnCreateNewDataBase, there is a message 'Access violation.Press OK to ignore,press cancel to stop the program'. (I look at the c:\mydb directory,the new database 'test.fdb' was created and its size is 584kb.) on page 325 of the document Apiguide.pdf it says: the 4th parameter of isc_dsql_execute_immediate(Length of the DSQL statement in bytes) should be set to 0 in C programs to indicate a null-terminated string. If I change it to Length(statement),the result is the same as above. ---------------------------------------------------------------------- Marc · 2006-04-07 10:22 first, when loading libs, keep the handle, you need to unload them. questions: - does lib := LoadLibrary('C:\FireBird15\bin\fbclient.dll') return a valid handle ? - does proc := GetProcAddress(lib,'isc_dsql_execute_immediate' ) return a valid adress ? - does status_vector need to be initialized ?