 Hey everybody, this is Brian and welcome to the 53rd Qt tutorial with C++ and GUI programming. All right now, we're continuing our database conversation and what you see before you is a very basic SQL insert statement. You insert into a table and you get a list of fields and each field has a corresponding value. And what we're going to discuss today is how to prepare a query and bind values into that query. Very simple. Let's just copy this, paste it here and we're just going to modify this a little bit. And let's just grab this whole line here, cut that out of there. Whoops, lost my window. And we'll say Q string and call this sQuery. And this is going to be our SQL query. It's technically not a query, it's more of a command, but you get the drift. So we have insert into test people and first name, last name, and the values. Now, what we need to do here is we need to actually prepare this statement. So we're going to add a little placeholder here. Call this first, and we'll call this last. You notice the semicolon in front? That's very important. That's what Qt's looking for here. All right, now we'll make our Q SQL query. And we're going to prepare our statement and just give it our string. And that loads it into the Q SQL query object. Now what we're going to do is bind values to that. So we're going to say query, bind value, and it wants the tag or the identifier that we gave it. So we'll say first, and then it wants the value. And we'll just say, like, I can't think of a good name. So I'm just going to put my daughter's name, Heather. And let's just do a little copy and paste magic here. And we're just going to insert my daughter's name. And when you do this, you can, you know, obviously don't have to use my daughter's name, although I'm sure she would be very flattered if you did. Let's review this real quick before we run it. We've got our basic database application is just going to open the connection. If the connection is open, then we're going to make a SQL query, we're going to prepare our string, which is just an insert. And you see we have two placeholders here first and last, notice the semicolon, that's very important. And then we are just binding the values, we're doing a bind value first and the bind value last, Heather Karens. So when we run this, it's going to execute this query if we actually write the source code for that. Sorry about that. So let's just say if query exec, and let's just copy and paste here. Let's say record, record inserted. Just to show you that there is no existing Heather out there. We got Bob Hope and Will Smith and that's it. So let's run this. And as you can see, it opened the connection, record inserted and close connection. Now we go back out to our database and rerun the query. You can see there's our row. So that is how preparing and binding works. Pretty simple, pretty good time saver. You should use this instead of trying to concatenate strings out in your actual query, that gets kind of messy. So this is Brian. I hope you found this tutorial educational and entertaining and thank you for watching.