Results 1 to 15 of 15

Thread: Sqlite data base

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Sqlite data base

    how to solve this problem please help me
    What problem?

    Did you look at the return value from QSqlQuery::exec()?
    Did that indicate that there was a problem?

    Did you read the QSqlError docs? They tell you what the error number -1 might mean.

    You really need to help yourself more.

  2. #2
    Join Date
    Apr 2011
    Posts
    27
    Qt products
    Qt3 Qt4
    Platforms
    Symbian S60

    Default Re: Sqlite data base

    QSqlError(1, "Unable to execute statement", "no such table: CityType") this error is find how to solve this problem please help me

    Thanks

  3. #3
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Sqlite data base

    "no such table: CityType"
    I think this sentence is clear enough.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Sqlite data base

    I told you the likely problem here. You don't have a table called CityType, so you cannot query it. Pretty simple really. If you don't understand why you don't have a table called CityType given the database creation code I referenced then there is little we can do to help.

    From your earlier post http://www.qtcentre.org/threads/41747-Sqlite-data-base
    Qt Code:
    1. QSqlQuery query;
    2. query.exec("create table person (Id int primary key,name varchar(20), typeid int)");
    3. query.exec("insert into person values(1, 'Delhi',101)");
    4. query.exec("insert into person values(2, 'Gurgaon',102)");
    5. query.exec("insert into person values(3, 'Noida',103)");
    6. query.exec("insert into person values(4, 'Gaziabad',104)");
    7. query.exec("insert into person values(5, 'faridabad',105)");
    8. //! [Set up the main table]
    To copy to clipboard, switch view to plain text mode 


    I am more confused how you go from "My query executed" with no error in your posts 9 and 10 of this thread, to this this very specific and informative error message. Are you working through this thing in any sort of methodical matter, or are you thrashing around in the hope that eventually you will get lucky, or someone will succumb and fix your code and post a complete implementation? The first approach will give you an understanding, the second and third will leave you with similar problems in a few days/months/years time and no idea how to deal with them.

    Take a step back from the code, look at what you are trying to achieve and write down in English/your native tongue the broad things you need to achieve to get there. Then break each down into smaller, more specific things, until each item is a manageable, small bit of C++/SQL/shell script code or manual activity. Then work through each in turn, making sure it works before moving on.

  5. #5
    Join Date
    Apr 2011
    Posts
    124
    Thanks
    1
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Default Re: Sqlite data base

    Either you're command of English is far worse than it appears, or you are not cut out to be a programmer. I'd strongly suggest that you consider other occupations.

Similar Threads

  1. Update changes in QTableView to sqlite data base
    By nagabathula in forum Qt Programming
    Replies: 2
    Last Post: 12th November 2011, 01:18
  2. Sqlite data base
    By sabbu in forum Newbie
    Replies: 2
    Last Post: 19th May 2011, 23:43
  3. Sqlite data base
    By sabbu in forum Qt Programming
    Replies: 5
    Last Post: 19th May 2011, 11:57
  4. Replies: 4
    Last Post: 19th December 2010, 06:15
  5. program for working with Data Base(i need it)
    By banakil in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2007, 22:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.