So if i just SELECT something i dont have to use the procedure; closeDB?!
No. You have TSQLQuery.Open and TSQLQuery.Close for SELECT statements (which return a dataset)
and you have TSQLQuery.ExecSQL for other statements.
But... for simple insert you can also do a TSQLQuery.Open on a SELECT * FROM TABLE
and use TSQLQuery.Insert; to put the dataset in insert mode.
You then can put anything into the fields with TSQLQuery.FieldByName('fieldname').asString := 'abc' for example
and do a TSQLQuery.Post to post the insert/edit
So in that case TSQLQuery.ExecSQL isn't even needed.
So i have to check the code of form 1 and two an delete every closeDB, when ijust select someting?!
That depends if you are executing an INSERT INTO or UPDATE. For that you do need ExecSQL (and your CloseDB).
But if you only want one INSERT INTO for SQLQuery1, then you shouldn't have ALL 4 SQLQuery1..4.ExecSQL in CloseDB because you haven't filled in SQLQuery2..3.SQL with a correct SQL statement.
But why i haave to add the last two lines? I have these just in the beginning.
// Form2.closeDB; // remove this line.
Form2.SQLQuery1.Open; // add this one
Form2.SQLQuery4.Open; // and this one
Sorry. My (copy and paste) mistake. That should be
// Form2.closeDB; // remove this line.
Form2.SQLQuery1.Close; // add this one
Form2.SQLQuery4.Close; // and this one