Results 1 to 6 of 6

Thread: Importing a local storage csv into sqlite database table?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2020
    Location
    Michigan
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Default Importing a local storage csv into sqlite database table?

    In my project I have created an sqlite database along with 3 tables...what I would like to do it take three csv files that are being downloaded, using the Qt Network Download example, and insert them into their appropriate tables so that I can work with the data (query, etc) in other qml pages within the app.

    I have seen some examples about parsing the files and inserting values but at the moment I have not been able to successfully insert the data from the csv files to the tables.

    If I include the code below to see if the file can be found, I do receive the "File is Open" response so that is a step in the right direction.

    Qt Code:
    1. QFile file("filename.csv");
    2. if(!file.open(QIODevice::ReadOnly)){
    3. qDebug() << "File not open" << file.error();
    4. } else {
    5. qDebug() << "File is open";
    6. }
    To copy to clipboard, switch view to plain text mode 

    Should this process be included in the Network Download code, which I have in a separate .cpp file or can it go right into the main.cpp file? Also - can someone point me in the direction of some good examples of this or provide some insight on how I might accomplish this?
    Last edited by luckachi; 14th September 2020 at 21:30.

Similar Threads

  1. Replies: 7
    Last Post: 27th March 2015, 16:43
  2. Accessing sql local storage from C++?
    By Koying in forum Qt Quick
    Replies: 1
    Last Post: 27th February 2014, 21:49
  3. Replies: 3
    Last Post: 26th February 2014, 05:56
  4. Importing a sqlite database into another...
    By mtnbiker66 in forum Qt Programming
    Replies: 0
    Last Post: 26th April 2012, 23:00
  5. QStandardItemModel to sqlite database table
    By sattu in forum Qt Programming
    Replies: 19
    Last Post: 11th March 2011, 00:01

Tags for this Thread

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.