Recent

Author Topic: Datamodule, what are they for? are they working?  (Read 6751 times)

gypsymauro

  • Newbie
  • Posts: 2
Datamodule, what are they for? are they working?
« on: November 19, 2009, 04:31:31 pm »
I created a new project , I added a new datamodule and then
on it I created a new postgresql connection, a transaction a datasource and a tquery object,
I connected them then I wrote a sql statement

select field1 from table, I run the query with the green button available when the query object
is connected to the db and it works, and it displays data.. but when I try to add fields
it says me

"it was not possible to get the dataset field's list check dataset settings, access violation"

then I create the same object on a form and everything goes right..
so are the Datamodule broken? I tried this on linux with 0.9.26 and 0.9.28


I hope there is a solution cause Datamodule are so usefull to keep ordered things :D

tank you
Mauro

a.atalla

  • Jr. Member
  • **
  • Posts: 82
Re: Datamodule, what are they for? are they working?
« Reply #1 on: June 12, 2010, 03:59:05 am »
i have similar problem here with lazarus 0.9.19 fromsvn  fpc2.4

i use datamodule contains sqlite3dataset and a datasource
when i try executing the following code in the main unit
i get the Access violation error

Code: [Select]
procedure TfrmMain.FormCreate(Sender: TObject);
begin
     DM.Sqlite3Dataset1.FileName:='st4.db';
     DM.Sqlite3Dataset1.TableName:='equipment';
     DM.Sqlite3Dataset1.Open;
end;   
Lazarus 1.0.8 | FPC 2.6.2 x64  | Arch Linux x64 | Windows 7-x86

bflm

  • Jr. Member
  • **
  • Posts: 54
    • Free Pascal Random Bits
Re: Datamodule, what are they for? are they working?
« Reply #2 on: June 12, 2010, 07:39:43 am »
i have similar problem here with lazarus 0.9.19 fromsvn  fpc2.4

i use datamodule contains sqlite3dataset and a datasource
when i try executing the following code in the main unit
i get the Access violation error

Code: [Select]
procedure TfrmMain.FormCreate(Sender: TObject);
begin
     DM.Sqlite3Dataset1.FileName:='st4.db';
     DM.Sqlite3Dataset1.TableName:='equipment';
     DM.Sqlite3Dataset1.Open;
end;   


Was a valid, non nil value ever assigned to 'DM' at the time 'TfrmMain.FormCreate' gets invoked? Can't figure out that from the snippet alone...

davesimplewear

  • Sr. Member
  • ****
  • Posts: 307
    • Davids Freeware
Re: Datamodule, what are they for? are they working?
« Reply #3 on: June 12, 2010, 06:59:53 pm »
also in the project form create is the datamodule the first form created? This will result in an error if not.

Regards
Dave
All things considered insanity seems the best option

 

TinyPortal © 2005-2018