As far as I know you can't insert into two tables with one SQL insert statement, so you need to prepare two statements, set all their strings, and execute them both. You may need to wrap them in a transaction if you are worried about database integrity after a partial failure.
Is there any reason why this would be a problem in your application?
"It gives me errors" tells us nothing. If you have a compiler or runtime error message post the complete message plus the actual code it refers to. If your code is giving an incorrect result explain what result you get and what the correct result should be.