Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137

    SQLite - HOW-TO: Populate via file's data

    Code:
    -- Will open, if it exists, or create a new database and put it on the Desktop
    db = SQLite.Open(_DesktopFolder.."\\a_database.db")
    
    -- Add in the table's fields (Column headings)
    SQLite.Query(db,"create table COMPANY(ID integer primary key, Company text, Address text, Phone text, Due integer)");
    
    -- Takes the file's data and puts it into an AMS table format
    tblRecs = TextFile.ReadToTable("AutoPlay\\Docs\\a_text_file.txt")
    
    --[[
    Finally, each item the previously made table has is added to the database
    
    Note:  When you add in the data it has to be in the order in which the
    Column headings were added into the database (ie. ID, Company, Address, Phone, Due in this example)
    Thus we are only adding in data to the second (2nd) position which is the Company name (where the 'v' is)
    ]]
    for i,v in tblRecs do
    	SQLite.Query(db,"insert into COMPANY values(NULL,".."'"..v.."'".."'','','','')");
    end


    ps. I kept this code short so that it would be easy to understand, but each time you Query to the database, you should check for errors.

    Code:
    err = Application.GetLastError();
    if err = SQLite.ERROR then
        strErrMsg = SQLite.GetLastErrorString();
        Debug.Print("Error: " .. strErrMsg);
    end
    Intrigued

  2. #2
    Join Date
    Oct 2004
    Location
    East, South & West Asia
    Posts
    1,020
    Hi Intrigue,

    We need your input for this thread....
    http://www.indigorose.com/forums/sho...t=17073&page=2
    Newbie Examples
    ------> AMS 7.5 : amstudio.azman.info
    ----> AMS 6 & 5: www.azman.info/ams/
    ----> FB: facebook.com/GuideToWealth

    ----> Content Development Blog: www.AZMAN.asia

  3. #3
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Yes, but this duct tape on my mouth (thanks to my wife) keeps me from commenting.

    Intrigued

  4. #4
    Join Date
    Oct 2004
    Location
    East, South & West Asia
    Posts
    1,020
    oooooooooo .... awesome ...

    We'll wait till da gum wears off.
    Newbie Examples
    ------> AMS 7.5 : amstudio.azman.info
    ----> AMS 6 & 5: www.azman.info/ams/
    ----> FB: facebook.com/GuideToWealth

    ----> Content Development Blog: www.AZMAN.asia

Similar Threads

  1. Unable to find software?
    By NigelLacey in forum Visual Patch 2.0
    Replies: 4
    Last Post: 10-11-2005, 10:35 AM
  2. SQLite data to HTML file
    By Intrigued in forum AutoPlay Media Studio 5.0
    Replies: 16
    Last Post: 10-23-2004, 03:19 AM
  3. INFO: Why Files are Renamed in the DATA Folder
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-24-2002, 03:36 PM
  4. FAQ: AutoPlay Menu Studio 3.0 Frequently Asked Questions
    By Support in forum AutoPlay Menu Studio 3.0
    Replies: 0
    Last Post: 10-10-2002, 01:15 PM
  5. INFO:The Files that are Built into the DATA Folder
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-03-2002, 03:15 PM

Posting Permissions

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