Recent

Author Topic: Another newbie question.  (Read 1527 times)

zoimutante

  • New Member
  • *
  • Posts: 34
Another newbie question.
« on: March 19, 2018, 02:55:33 pm »
I have tsqlite3connection in the data module, ok ?
Every time I  need to use it, from Form1 I declare unit2 in uses of unit1 and Iwrote Unit2.DataModule1.Sqlite3connection.enything to access it and I get a access violation, It is some thing I'm doing wrong ? The same don't happen when I put tsqlite3connection on form1

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Another newbie question.
« Reply #1 on: March 19, 2018, 03:00:55 pm »
Check the creation order in the .lpr and make sure unit2 is first.

zoimutante

  • New Member
  • *
  • Posts: 34
Re: Another newbie question.
« Reply #2 on: March 19, 2018, 03:28:13 pm »
Thanks MarcoV it works
One more thing, there is a way to assign a variable a pointer to  represent Unit2.DataModule1 to save all writing ? I try with var db:String=Unit2.DataModule1; but don't seems to work

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: Another newbie question.
« Reply #3 on: March 20, 2018, 08:30:45 am »
datamodule1 is not a string. If the datamodule is global and put in the uses section all you have to do is call datamodule1.
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

 

TinyPortal © 2005-2018