Lazarus string Insert error lazarus / 31-LCL ---------------------------------------------------------------------- JD · 2010-03-16 22:49 Hi there everyone, I keep getting the error "Wrong number of parameters" on this line of code Insert('<< Name >>' , strFieldIsEmptyError, 10); where strFieldISEmptyError := 'The field cannot be empty'; I did some snooping & I found that the compiler looks in db.pas for the definition on the string insert command assuming that I want to insert a record into a table. I changed the line to Code: [Select]System.Insert('<< Name >>' , strFieldIsEmptyError, 10);and then to Code: [Select]UTF8Insert('<< Name >>' , strFieldIsEmptyError, 10);and both times I got an error saying "Variable identifier expected". The code works in Delphi so I'd like to know the Lazarus equivalent for the Delphi string Insert procedure. Thanks a lot ---------------------------------------------------------------------- Leledumbo · 2010-03-17 03:24 Here's the documentation of System's Insert. What is the type of strFieldISEmptyError? If it's a constant or property, then definitely a compile error would come. ---------------------------------------------------------------------- JD · 2010-03-17 08:15 Quote from: Leledumbo on March 17, 2010, 04:24:34 amHere's the documentation of System's Insert. What is the type of strFieldISEmptyError? If it's a constant or property, then definitely a compile error would come. strFieldISEmptyError is a resourcestring. That may be the problem. I'll try the code with an ordinary string variable. ---------------------------------------------------------------------- Leledumbo · 2010-03-17 09:20 QuotestrFieldISEmptyError is a resourcestring. That may be the problem.Aha, so that's it. A resourcestring is actually a constant instead of a variable. Since Insert modifies its parameter, you can't use pass resourcestring to it. ---------------------------------------------------------------------- JD · 2010-03-17 12:25 Quote from: Leledumbo on March 17, 2010, 10:20:25 amQuotestrFieldISEmptyError is a resourcestring. That may be the problem.Aha, so that's it. A resourcestring is actually a constant instead of a variable. Since Insert modifies its parameter, you can't use pass resourcestring to it. I changed the code to Code: [Select]      strErrorString := strFieldIsEmptyError;       UTF8Insert('<< First Name >>', strErrorString, 10);       MessageError(Self, strDataEntryError, strErrorString); Thanks for the tip.