Creating a database
In this recipe, we will be prompting the user to enter a database name, followed by clicking the push button. Upon clicking the push button, if the specified database does not exist, it is created and, if it already exists, it is connected.
How to do it…
Follow this step-by-step procedure to create a database in SQLite:
- Let's create an application based on the 
Dialog without Buttonstemplate. - Add two 
QLabelwidgets, oneÂQLineEdit widget, and oneÂQPushButtonwidget to the form by dragging and dropping twoLabel widget, oneLine Edit widget, and aPush Buttonwidget on the form. - Set the 
textproperty of the firstLabelwidget toEnter database name. - Delete the 
textproperty of the secondLabelwidget because this is established. - Set the 
objectNameproperty of theLine Editwidget tolineEditDBName. - Set the 
objectNameproperty of thePush Buttonwidget topushButtonCreateDB. - Set the 
objectNameproperty of the secondLabelwidget tolabelResponse. - Save the application by name as 
demoDatabase...