OK guys, before some research and no lucky, I cant find what i need, so i came back hier.
I'm doing a simple project inside of Lazarus and my project is just some inserts and selects from the database, but i'm confused with my research and all the forum information that I've found.
I'm my database i have 3 tables where I need to insert the values at same transaction, usualy for this case I can use this SQL code:
But my problem is that i cant find a way to setup this SQL inside of Lazarus and Zeos to get the same result, i've tryied the TZQuery with some sintax that i've found over the internet (something like this);
I've got a problem with the : if I try to activate my connection talbe I got a SQL error and 'name NULL' instead of something else. but I've started all of them on the 'before open event' in my table (not sure because my dbe fiels are empty when i try actvate):
table.ParamByName('name').AsString:=main_form.dbeditName.Text;
I also tryied another code with some sql statements under the TZConnection but something is messed up and i got another weird error, this code select the last inserted value then update it and create a blank inser, if I close and run the application again the code select the first register and update it.
datamodule.zconnection.AutoCommit:=True;
datamodule.zconnection.StartTransaction;
try
datamodule.table.Insert;
datamodule.table.FieldByName('name').AsString:=dbeditName.Text;
datamodule.table.Post;
datamodule.zconnection.Commit;
except
datamodule.zconnection.Rollback;
end;
I'm not sure if this last method work with my triple table and no ideia how to select the user id to insert into the other tables (maybe a var can help, but not sure yet).
So someone can give a giant and huge and and make a favor and try to explain how I can use the sql language under the tzquery?
Has i said I've made a research but cant find any awser that can help me.
DBEdits and some DBLookUpComboBox.
Sorry to annoy and also sorry my bad english, thanks very much.