Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3

Thread: Sqlite question

  1. #1
    Join Date
    Jul 2004
    Posts
    313

    Sqlite question

    HI, I am trying to grasp this Sqlite plugin but just can get the hang of it.
    All I need is a page with 1 button and upon clicking that button data will be entered into the database. can anyone please send me a sample so I can see how It's done?

    Thanks.

  2. #2
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    939
    HI, I started my learning process like this:

    Create a button, cut’n paste the code from Example 3 in the help file (SQLite-QueryToTable()). Play with that code. Change ‘dbname’ from “;memory:” to a file name. Visit www.sqlite.org. Search AMS forum for “SQLite”. You will find several useful links and advices. Download sqlitebrowser.exe; very handy in the learning process. Have a look at Yearbook.apz.

    So far I have succeeded to create two db.tables – “Customer” and “Turnover” – from CSV files. “Customer” is some of my EXEs in Program Files and “Turnover” is DLLs found in my program folder and with connection to the “customers”. The file size is the sales amount! I am going to play with this database to understand the aspect of SELECT, UPDATE and so on. I don’t think it is good idea to publish this project as a “demo”; it is not “clean” enough. And I’m still learning...(have a look at my post “Wrong direction”).

    Good luck!

  3. #3
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    I did much the same csd214 did.

    Here is some code from a project I am working on now. This is one way of doing such.

    Code:
    -- Set variables for each Input Object on the page
    
    company_name = Input.GetText("CompanyINP");
    address = Input.GetText("AddressINP");
    addresstwo = Input.GetText("Address2INP");
    city = Input.GetText("CityINP");
    state = Input.GetText("StateINP");
    zip = Input.GetText("ZIPINP");
    phone = Input.GetText("PhoneINP");
    fax = Input.GetText("FAXINP");
    email = Input.GetText("EmailINP");
    auth_rep = Input.GetText("AuthRepINP");
    
    -- Format the data that the user typed into the Input fields in a manner that  will show best in the Paragraph Object
    
    all_company_info = company_name.."\r\n"..address.."\r\n"..addresstwo.."\r\n"..city.."\r\n"..state.."\r\n"..zip.."\r\n"..phone.."\r\n"..fax.."\r\n"..email.."\r\n"..auth_rep;
    
    Paragraph.SetText("Paragraph1", all_company_info);
    
    ---------------------------------------------------------------------------------------
    
    -- Select all from the compinfodb database
    -- Then as long as all of the Input objects are not blank continue on
    
    tblRecords = SQLite.QueryToTable(compinfodb, "select * from CUSTOMERS");
    
    count = 1;
    
    if (company_name ~= "") and (address ~= "") and (addresstwo ~= "") and (city ~= "") and (state ~= "") and (zip ~= "") and (phone ~= "") and (fax ~= "") and (email ~= "") and (auth_rep ~= "") then
    
    -- This is where the data is actually put into (or replaced) the database
    
    SQLite.Query(compinfodb, "insert or replace into COMPINFO values("..count..", "..Enclose(company_name)..", "..Enclose(address)..", "..Enclose(addresstwo)..", "..Enclose(city)..", "..Enclose(state)..", "..Enclose(zip)..", "..Enclose(phone)..", "..Enclose(fax)..", "..Enclose(email)..", "..Enclose(auth_rep)..")");
    	
    	Input.SetText("CompanyINP", "");
    	Input.SetText("AddressINP", "");
    	Input.SetText("Address2INP", "");
    	Input.SetText("CityINP", "");
    	Input.SetText("StateINP", "");
    	Input.SetText("ZIPINP", "");
    	Input.SetText("PhoneINP", "");
    	Input.SetText("FAXINP", "");
    	Input.SetText("EmailINP", "");
    	Input.SetText("AuthRepINP", "");
    
    		Page.SetFocus("CompanyINP");
    			
    			Dialog.TimedMessage("Success!", "Company information updated in the database!", 2000, MB_ICONINFORMATION);
    
    
    else
    
    	-- Else if any fields are missing data then the user must fill them in before data will be inserted into the database
    
    	Dialog.TimedMessage("Failure", "Some fields are missing information!", 2000, MB_ICONEXCLAMATION);
    end
    
    
    ---------------------------------------------------------------------------------------
    Intrigued

Similar Threads

  1. SQLite Command Question (DELETE ROW)...
    By Intrigued in forum AutoPlay Media Studio 5.0
    Replies: 15
    Last Post: 12-08-2006, 11:17 AM
  2. Hey guys! Remember me? - I have a question about SQLite....
    By CelticDragon in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 05-20-2004, 05:08 PM
  3. sqlite database question
    By dulux1309 in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 04-08-2004, 12:33 PM
  4. Sqlite question
    By dulux1309 in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 03-23-2004, 05:14 AM
  5. Broad question re potential for SQLite, plugin, et. al.
    By sferguson in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 01-08-2004, 08:40 AM

Posting Permissions

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