Results 1 to 2 of 2

Thread: Problem with A SQLite Query

  1. #1
    Join Date
    May 2008
    Posts
    27
    Qt products
    Qt4
    Platforms
    Windows

    Question Problem with A SQLite Query

    Hi,
    all, i am trying to change the name of my table name present in my database....
    i am using this query

    ALTER TABLE USERS RENAME TO USERS1 this thing works very good...
    the problem is i need to create my table name basing upon the current system time....
    is this possible.... to have system current time as my table...

    the query for that which i am trying is


    Alter table USERS1 Rename to time('now','localtime'); query string is returning an exception saying that " there is an error at '(' "


    So can any one help me sorting this


    Thanks in advance....

  2. #2
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: Problem with A SQLite Query

    Hi,

    Why are you not using a QTime/Date function .toString and add this to your query as a parameter ... e.g.

    Qt Code:
    1. query.exec("Alter table USERS1 Rename to " + QTime::currentTime ().toString(your format))
    To copy to clipboard, switch view to plain text mode 

    But I think "." is not allowed as a character in a table name ... use something else then

Similar Threads

  1. Sql Query Problem
    By MrShahi in forum Qt Programming
    Replies: 6
    Last Post: 30th May 2008, 09:16
  2. SQLITE QTableView scrollTo problem
    By vogeljh in forum Newbie
    Replies: 7
    Last Post: 16th April 2008, 19:45
  3. SQLite Problem
    By natbobc in forum Qt Programming
    Replies: 5
    Last Post: 8th November 2007, 15:31
  4. Problem with SqLite and Qt
    By ad5xj in forum Newbie
    Replies: 26
    Last Post: 5th June 2007, 01:53

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.