×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question QSqlQuery Problem 2

    Dear All,

    i created a table like this ,
    i need primary key for both column -- id,FNumber

    Code:
    ret = query.exec("create table FilterNumTable "
                   "(id integer,"
                   "FNumber varchar(20),"
                   "Enable varchar(30),"
                   "Disable varchar(30),"
                   "PRIMARY KEY (FNumber , id))");
    Table itself not creating>any one have idea in QT to how to creata a table with two
    primary column.
    Last edited by damodharan; 2010-06-03 at 10:20.

  2. #2
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Re: QSqlQuery Problem 2

    thx to all,
    issue resolved.

  3. #3
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QSqlQuery Problem 2

    Did you forget semicolon at the end of the SQL query?
    Last edited by divanov; 2010-06-03 at 12:49. Reason: typo

  4. #4
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Re: QSqlQuery Problem 2

    Quote Originally Posted by divanov View Post
    Did you forget semicolon at the end of the SQL query?
    no no divanov, syntax is correct,i normal sqllite i check the syntax its working fine.
    but now i am checking in Qt how its taking two primary key in single table,

  5. #5
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QSqlQuery Problem 2

    I was not able to reproduce the problem
    Code:
    #include <QtCore>
    #include <QtSql>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
        db.setDatabaseName("customdb");
        if (!db.open())
            qDebug() << db.lastError();
        QSqlQuery q;
        q.prepare("create table FilterNumTable "
                   "(id integer,"
                   "FNumber varchar(20),"
                   "Enable varchar(30),"
                   "Disable varchar(30),"
                   "PRIMARY KEY (FNumber , id))");
        if (!q.exec())
            qDebug() << q.lastError();
    
        qDebug() << db.tables();
    
        db.close();
    }

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: QSqlQuery Problem 2

    Qt doesn't do anything to the query arguments other than to wave at them as they pass. If it works in stand-alone SQLite, it should work in Qt SQLite.

  7. #7
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Thumbs up Re: QSqlQuery Problem 2

    Quote Originally Posted by danhicksbyron View Post
    Qt doesn't do anything to the query arguments other than to wave at them as they pass. If it works in stand-alone SQLite, it should work in Qt SQLite.
    thx for ur ans danhicksbyron.

Similar Threads

  1. STLPort namespace issue
    By yickhong in forum Open C/C++
    Replies: 0
    Last Post: 2009-04-09, 08:54
  2. SyncML link problem
    By samuel_ in forum Symbian C++
    Replies: 4
    Last Post: 2009-03-27, 08:02
  3. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  4. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  5. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •