Creation SQLITE database
-
Excuse me then ..
Let's focus on the SQLITE database.
Look at the code of the database.
Is this correct?Thanks
wrote on 24 Mar 2019, 12:11 last edited by@Nafab213
No, because I spot"Sexe varcher (1)"
But then, politely, I didn't realise I was responsible for spotting spelling mistakes, having to look at every single character in what you have typed.
And then you also have:
"Varchar(20), " "matiere(20),"
which are both obviously wrong. And nobody could possibly write this correctly for you, because they won't know what you actually want.
If you are going to have this level of problem, I would suggest you get hold of whatever equivalent of MySQL Workbench that SQLite provides (I know it provides something similar) and get the SQL code working there each time, before you copy it into your Qt code. You will get much better help on mistakes etc. interactively in a tool like that than direct from Qt code. This is not an "annoyance" for you, it looks like you really do need to do that in order to get anywhere productively.
-
wrote on 24 Mar 2019, 12:22 last edited by
I understood
For the "Sex Varcher (1)" because I would like to store a single letter in it.
either M for Male or F for Female.
It's good as that ?For
"Varchar (20),"
"Material (20),"
It's a mistake I wanted to write
"matiere Varchar(20), "I already corrected in the file.
Other errors?
Thank you.... -
I understood
For the "Sex Varcher (1)" because I would like to store a single letter in it.
either M for Male or F for Female.
It's good as that ?For
"Varchar (20),"
"Material (20),"
It's a mistake I wanted to write
"matiere Varchar(20), "I already corrected in the file.
Other errors?
Thank you....@Nafab213
Hi
For
db.setDatabaseName("......"); //Each User give an name at database
you can use https://doc.qt.io/qt-5/qinputdialog.htmlbool ok; QString text = QInputDialog::getText(this, tr("Add New Database"), tr("database name:"), QLineEdit::Normal, "default", &ok); if (ok && !text.isEmpty()) databasename=text; // ....
Also this tool is super for inspecting the database and learn about it
https://sqlitebrowser.org/ -
@Nafab213
Hi
For
db.setDatabaseName("......"); //Each User give an name at database
you can use https://doc.qt.io/qt-5/qinputdialog.htmlbool ok; QString text = QInputDialog::getText(this, tr("Add New Database"), tr("database name:"), QLineEdit::Normal, "default", &ok); if (ok && !text.isEmpty()) databasename=text; // ....
Also this tool is super for inspecting the database and learn about it
https://sqlitebrowser.org/wrote on 24 Mar 2019, 12:49 last edited by JonBFor the "Sex Varcher (1)" because I would like to store a single letter in it.
No, because I said you have mis-spelt it. You need to look carefully at how you spell words, that is an extremely common part of programming for which you are really responsible. That's why I said you would really benefit from doing this in an interactive tool, not in code. Please do yourself a favor and download @mrjj 's link to https://sqlitebrowser.org/, believe me it's going to be worth it for you.
-
wrote on 24 Mar 2019, 12:56 last edited by
I received your answer and I will read the links afterwards.
So for my base ..
Do you have any advice to give me on my database?
Look at this part of my code ..if(!db.open()) { QMessageBox::critical(0, qApp->tr("Cannot open database"), qApp->tr("La connexion n'est pas correctement établis à la base de donnée" "Reprenez le processus.\n\n" "Cliquer sur annuler pour quitter"); return false ; //i don't know if it's necessary }
It's necessary ?
Thanks -
I received your answer and I will read the links afterwards.
So for my base ..
Do you have any advice to give me on my database?
Look at this part of my code ..if(!db.open()) { QMessageBox::critical(0, qApp->tr("Cannot open database"), qApp->tr("La connexion n'est pas correctement établis à la base de donnée" "Reprenez le processus.\n\n" "Cliquer sur annuler pour quitter"); return false ; //i don't know if it's necessary }
It's necessary ?
ThanksHi
Yes, good error handling is always needed.
But the function it lives in has void as return.void FenCene::newfiledb() // SLot no connected....
{ ...so it should be just
return; -
wrote on 24 Mar 2019, 14:25 last edited by
mrr
Excuse me but you talk about
"// SLot no connected ...."
{...
It's just a comment I forgot to take away.
Did you read my starting post?
Thnks -
mrr
Excuse me but you talk about
"// SLot no connected ...."
{...
It's just a comment I forgot to take away.
Did you read my starting post?
Thnks@Nafab213
Hi, i talk about the return statement inif(!db.open()) { QMessageBox::critical(0, qApp->tr("Cannot open database"), qApp->tr("La connexion n'est pas correctement établis à la base de donnée" "Reprenez le processus.\n\n" "Cliquer sur annuler pour quitter"); return false ; //i don't know if it's necessary -> should just be return, since parent function has void as return. }
-
wrote on 24 Mar 2019, 17:03 last edited by
29/5000
Thanks mrjj
How can I fix that ?Thnks
-
@Nafab213
Hi
fix ?
the return ? just remove false;or do you mean 29/5000 ?
-
wrote on 25 Mar 2019, 12:21 last edited by
When I compile it gives me a lot of error that I do not understand. And I will post the notifications on the forum but before I will correct syntax and vocabulary errors.
Thank you for your help. -
wrote on 25 Mar 2019, 22:56 last edited by
@mrjj said in Creation SQLITE database:
or do you mean 29/5000 ?
I guess 29/5000 is the amount of typed characters in this message :-)
18/20