Error: Incompatible types: got "LongInt" expected "AnsiString" lazarus / 16-Databases ---------------------------------------------------------------------- panoss · 2014-12-05 23:16 I have  TSQLQuery named qryItemsSubCategories. I want to change it's QL property like this: Code: [Select]DM.qryItemsSubCategories.SQL:='Select * FROM ItemsSubCategories WHERE CategoryID=' + DM.qryItems.FieldByName('CategoryID').AsInteger; But this raises an error: Error: Incompatible types: got "LongInt" expected "AnsiString" Also tried .AsString, it also raises this error (Error: Incompatible type for arg no. 1: Got "AnsiString", expected "TStringList") How can I fix it? ---------------------------------------------------------------------- Syndrome · 2014-12-06 00:24 DM.qryItemsSubCategories.SQL:='Select * FROM ItemsSubCategories WHERE CategoryID=' + IntToStr(DM.qryItems.FieldByName('CategoryID').AsInteger); ---------------------------------------------------------------------- taazz · 2014-12-06 00:53 Quote from: panoss on December 06, 2014, 12:16:54 amI have  TSQLQuery named qryItemsSubCategories. I want to change it's QL property like this: Code: [Select]DM.qryItemsSubCategories.SQL:='Select * FROM ItemsSubCategories WHERE CategoryID=' + DM.qryItems.FieldByName('CategoryID').AsInteger; But this raises an error: Error: Incompatible types: got "LongInt" expected "AnsiString" Also tried .AsString, No you did not, try rebuilding everything delete all .o .ppu and every single compiled unit from your project then try again. .AsString should work. ---------------------------------------------------------------------- Leledumbo · 2014-12-06 07:58 Quote from: taazz on December 06, 2014, 01:53:31 amQuote from: panoss on December 06, 2014, 12:16:54 amI have  TSQLQuery named qryItemsSubCategories. I want to change it's QL property like this: Code: [Select]DM.qryItemsSubCategories.SQL:='Select * FROM ItemsSubCategories WHERE CategoryID=' + DM.qryItems.FieldByName('CategoryID').AsInteger; But this raises an error: Error: Incompatible types: got "LongInt" expected "AnsiString" Also tried .AsString, No you did not, try rebuilding everything delete all .o .ppu and every single compiled unit from your project then try again. .AsString should work. It should not. He assigns it to SQL, not SQL.Text. ---------------------------------------------------------------------- panoss · 2014-12-06 08:29 Quote from: Syndrome on December 06, 2014, 01:24:50 amDM.qryItemsSubCategories.SQL:='Select * FROM ItemsSubCategories WHERE CategoryID=' + IntToStr(DM.qryItems.FieldByName('CategoryID').AsInteger); No, this also gives an error: uitemsaddnewedit.pas(90,145) Error: Incompatible type for arg no. 1: Got "AnsiString", expected "TStringList" ---------------------------------------------------------------------- panoss · 2014-12-06 08:35 Quote from: taazz on December 06, 2014, 01:53:31 amQuote from: panoss on December 06, 2014, 12:16:54 amI have  TSQLQuery named qryItemsSubCategories. I want to change it's QL property like this: Code: [Select]DM.qryItemsSubCategories.SQL:='Select * FROM ItemsSubCategories WHERE CategoryID=' + DM.qryItems.FieldByName('CategoryID').AsInteger; But this raises an error: Error: Incompatible types: got "LongInt" expected "AnsiString" Also tried .AsString, No you did not, try rebuilding everything delete all .o .ppu and every single compiled unit from your project then try again. .AsString should work. I tried this but didn't compile, returned me error: /usr/share/lazarus/1.2.6/ide/lazarus.pp(141,1) Error: Can't call the resource compiler "/usr/bin/fpcres", switching to external mode ---------------------------------------------------------------------- mangakissa · 2014-12-06 11:26 Try to read what other people says. qryItemsSubCategories.SQL is a member of TStrings. Use SQL.text to put your query in Code: [Select]DM.qryItemsSubCategories.SQL.text :='Select * FROM ItemsSubCategories WHERE CategoryID=' + DM.qryItems.FieldByName('CategoryID').AsString; if you use FieldByName('CategoryID').AsInteger then convert it to IntToStr(). FieldByName() is variant, so .AsString can be used. Internally Yuor integer will be converted to string. ---------------------------------------------------------------------- panoss · 2014-12-06 13:26 mangakissa this did the trick. Thanks! But now my problem is that Lazarus won't compile+build (as above mentioned) with this project (it does with other projects). So I guess the problem is in my project. But how will I find it? ---------------------------------------------------------------------- Leledumbo · 2014-12-06 13:44 Quote from: panoss on December 06, 2014, 02:26:46 pmmangakissa this did the trick. Thanks! But now my problem is that Lazarus won't compile+build (as above mentioned) with this project (it does with other projects). So I guess the problem is in my project. But how will I find it? Just ensure the mentioned tool exist and is executable. ---------------------------------------------------------------------- panoss · 2014-12-06 13:54 I guess by 'tool' you mean fpcres. It exists, it's in /usr/bin directory, and is executable. 'ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped'. Also there is a directory 'fpcres':  (/usr/share/fpcsrc/2.6.4/utils/fpcres) ---------------------------------------------------------------------- Leledumbo · 2014-12-07 05:46 Quote from: panoss on December 06, 2014, 02:54:49 pmI guess by 'tool' you mean fpcres. It exists, it's in /usr/bin directory, and is executable. 'ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped'. Also there is a directory 'fpcres':  (/usr/share/fpcsrc/2.6.4/utils/fpcres) The permission? ---------------------------------------------------------------------- panoss · 2014-12-07 08:19 I think they 're ok, have a look at the attachment. ---------------------------------------------------------------------- Leledumbo · 2014-12-07 12:41 Quote from: panoss on December 07, 2014, 09:19:46 amI think they 're ok, have a look at the attachment. No no no, not the folder, but the executable in /usr/bin ---------------------------------------------------------------------- panoss · 2014-12-07 15:21 And the executable has the same rights as the above mentioned directory. ---------------------------------------------------------------------- Leledumbo · 2014-12-08 00:11 Quote from: panoss on December 07, 2014, 04:21:11 pmAnd the executable has the same rights as the above mentioned directory. Can you run it? Simply run without parameters, at least it should display help info. ---------------------------------------------------------------------- panoss · 2014-12-08 14:17 But the project runs. It compiles and runs, without any error message. The problem showed up when I tried to build Lazarus with this project. When I built Lazarus with some other project, it builds just fine. ---------------------------------------------------------------------- Leledumbo · 2014-12-08 17:18 Quote from: panoss on December 08, 2014, 03:17:41 pmBut the project runs. It compiles and runs, without any error message. The problem showed up when I tried to build Lazarus with this project. When I built Lazarus with some other project, it builds just fine. OK, that's cute. I can't think of any possibility right now.