Indigo Rose Software
  #1  
Old 08-30-2006
Intrigued's Avatar
Intrigued Intrigued is online now
Indigo Rose Customer
 
Join Date: Dec 2003
Location: Location! Location!
Posts: 6,058
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
www.amsuser.com
Reply With Quote
  #2  
Old 09-01-2006
azmanar's Avatar
azmanar azmanar is offline
Indigo Rose Customer
 
Join Date: Oct 2004
Location: East, South & West Asia
Posts: 948
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/
----> Twitter: www.twitter.com/azmanar/
Reply With Quote
  #3  
Old 09-03-2006
Intrigued's Avatar
Intrigued Intrigued is online now
Indigo Rose Customer
 
Join Date: Dec 2003
Location: Location! Location!
Posts: 6,058
Yes, but this duct tape on my mouth (thanks to my wife) keeps me from commenting.

__________________
Intrigued
www.amsuser.com
Reply With Quote
  #4  
Old 09-04-2006
azmanar's Avatar
azmanar azmanar is offline
Indigo Rose Customer
 
Join Date: Oct 2004
Location: East, South & West Asia
Posts: 948
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/
----> Twitter: www.twitter.com/azmanar/
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to find software? NigelLacey Visual Patch 2.0 4 10-11-2005 11:35 AM
SQLite data to HTML file Intrigued AutoPlay Media Studio 5.0 16 10-23-2004 04:19 AM
INFO: Why Files are Renamed in the DATA Folder Support AutoPlay Media Studio 4.0 Examples 0 10-24-2002 04:36 PM
FAQ: AutoPlay Menu Studio 3.0 Frequently Asked Questions Support AutoPlay Menu Studio 3.0 0 10-10-2002 02:15 PM
INFO:The Files that are Built into the DATA Folder Support AutoPlay Media Studio 4.0 Examples 0 10-03-2002 04:15 PM


All times are GMT -6. The time now is 11:51 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software