Database question lazarus / 16-Databases ---------------------------------------------------------------------- yordan · 2010-12-07 09:36 Hi, I'm new in Lazarus programming and I have troubles manipulating SQL database with Lazarus.  I am trying to create a small program that inserts a new row in an existing table grupist, the code I use is:  procedure TForm1.Button1Click(Sender: TObject); begin   SQLQuery1.SQL.Text:='insert into grupist (kod,name) values (12,'+ Edit1.Text + ')';   SQLQuery1.ExecSQL; end;     but when I execute my application I get the following message: 'MySQL50Connection1: Error executing query: Unknown column 'ZZZZZ' in field list'  Please tell me what should I do to fix this error.  Thanks ---------------------------------------------------------------------- jixian.yang · 2010-12-07 10:26 There should be "Edit1.Text" if it is string: SQLQuery1.SQL.Text:='insert into grupist (kod,name) values (12,'+ QuotedStr(Edit1.Text) + ')'; ---------------------------------------------------------------------- yordan · 2010-12-07 10:50 Thanks, it works now ---------------------------------------------------------------------- yordan · 2010-12-09 11:27 Another issue occur with this program, I modified it to count the rows in the DBGrid1 in the form with: M := DBGrid1.FieldCount; and when I changed back the code and compiled it again I got the message: MySQL50Connection1: Server connect failed. I tried rewriting the program into another project after successful compiling the same error message is shown. The strangest thing is that Lazarus actually creates the exe file and when I run it it works OK. Anyone have a clue what might have happened ? ---------------------------------------------------------------------- jixian.yang · 2010-12-09 15:44 Check project.lpr. ---------------------------------------------------------------------- Lacak2 · 2010-12-13 06:35 Quote from: yordan on December 09, 2010, 12:27:34 pmI modified it to count the rows in the DBGrid1 in the form with: M := DBGrid1.FieldCount; Count of rows ? (IMHO RecordCount, not FieldCount ;-))