Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
 
I just need help with my project. I am using Qt creator for Mobile symbian OS.
I just would like to know what is the best Insert Command to enable the user to save input data into SQLite.
 
I have this code:
void addtrnsc::on_pushButton_clicked()
{
    QSqlDatabase myDB = QSqlDatabase::addDatabase("QSQLITE");
    myDB.setDatabaseName(Path_to_DB);
 
    if (!myDB.open())
    {
        QMessageBox::critical(0, tr("no Con"), tr("unable to stablish"));
        return;
 
    }
    QSqlQuery query;
    query.exec("insert into expense values(Descrition, Amount, Type, Date) VALUES ("+ui->txtDescrip->text()+","+ui->txtamount->text()+","+ui->comboxtype->currentText()+","+ui->dateEdit->text());
}
 
or can you give me a sample logic that will insert input data to databse..
 
I do not know if what is next and I do not know if it will work.
Can someone please help me with this?
 
Thanks
Posted 25-Jan-13 11:37am
Edited 25-Jan-13 12:15pm
v4

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This will help with your insert statement,
 
http://www.w3schools.com/sql/sql_insert.asp[^]
 
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 sanket saxena 355
1 Abhinav S 303
2 Sergey Alexandrovich Kryukov 299
3 OriginalGriff 225
4 thatraja 220
0 Sergey Alexandrovich Kryukov 8,497
1 OriginalGriff 4,850
2 Peter Leow 3,839
3 Maciej Los 3,535
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid