Recent

Author Topic: TSQLQuery reports "Invalid Property value"  (Read 3294 times)

mirce.vladimirov

  • Full Member
  • ***
  • Posts: 229
TSQLQuery reports "Invalid Property value"
« on: May 12, 2011, 02:22:01 pm »
I use Lazarus0.9.30 under windowsXP.
I have made a project with menu-form that calls other forms. I only use one connection to the database, and I placed it on the menu-form. All other forms that have queries use that connection. The latest form that I'm designing, I placed a query, I set it's property "database" to point to the same connection that is placed on the main form, and then I tested it, and everything worked fine.
Then I placed a second query on the same form, but when I try to set the "database" property it reports "Invalid Property value" ?!?
What's that ? Everything I did, I did the same and only way I know, nothing is diferent ?
I press F9 to test the first query if it's still going to work - and it did, it stil works. But the second query on the same form doesnot want to work, it doesnot want to see the connection on the menu-form. Why ? What should I do to overcome this, I love to use only one connection in one application.

mirce.vladimirov

  • Full Member
  • ***
  • Posts: 229
Re: TSQLQuery reports "Invalid Property value"
« Reply #1 on: May 12, 2011, 02:55:52 pm »
I found a way to solve it, but I dont know why is it happening.
I opened the *.lfm file of the named form. Remember, Lazarus creates files with extension .pas, where it keeps the Pascal code, and another one with extension .lfm where it keeps some information. So i opened that one, the *.lfm file, and found the lines that apply to the query that makes the problem, and it was missing the lines  with :
Code: [Select]
   Database = fmeni.MySQL50Connection1
    Transaction = fmeni.SQLTransaction1
while the other query (one that wokrs) had these lines. So, i simply typed these lines, and here's the complete section of the trouble-making query :

Code: [Select]
 object qgrid: TSQLQuery
    IndexName = 'DEFAULT_ORDER'
    Database = fmeni.MySQL50Connection1
    Transaction = fmeni.SQLTransaction1
    ReadOnly = False
    Params = <>
    left = 40
    top = 174
  end                      
And that finished the job.
But, I think that it's a bug of Lazarus : one form, two queries, one query wokrs, other doesnot.
The Lazarus IDE for some reason once writes these lines into the myform.lfm and once doesnot.
« Last Edit: May 12, 2011, 02:58:40 pm by mirce.vladimirov »

 

TinyPortal © 2005-2018