|
#1
|
||||
|
||||
|
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
|
|
#2
|
||||
|
||||
|
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/ |
|
#3
|
||||
|
||||
|
Yes, but this duct tape on my mouth (thanks to my wife) keeps me from commenting.
|
|
#4
|
||||
|
||||
|
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/ |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
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.








Linear Mode

