synistics
03-26-2007, 06:22 AM
First crack at this and followed it through to the end, but it is not putting the data into the DB file. The dummy line I wrote directly in is showing in the list.box, but not the entered data into the form.
function PopLBFromDB()
tbReturn =SQLite.QueryToTable(db, "SELECT * FROM signup");
--clear items from listbox
--ListBox.DeleteItem("LB", LB_ALLITEMS);
--do the following if there are rows
if tbReturn and tbReturn.Rows > 0 then
for i,v in tbReturn.Data do
ListBox.AddItem ("LB", tbReturn.Data [i]["FIRST_NAME"], tbReturn.Data [i]["LAST_NAME"], tbReturn.Data [i]["ADDRESS"], tbReturn.Data [i]["ADDRESS2"], tbReturn.Data [i]["TOWN"], tbReturn.Data [i]["PROV_ST"], tbReturn.Data [i]["COUNTRY"], tbReturn.Data [i]["POSTAL"], tbReturn.Data [i]["DAY"], tbReturn.Data [i]["NIGHT"], tbReturn.Data [i]["EMAIL"], tbReturn.Data [i]["EMAIL2"], tbReturn.Data [i]["PASS"], tbReturn.Data [i]["PASS2"], tbReturn.Data [i]["SUBSCRIPTION"]);
end
end
end
function Enclose(strText)
return string.format("%q",strText);
end
function AddtoDB()
local strFIRST = Input.GetText("FIRST");
local strLAST = Input.GetText("LAST");
local strADDRESS = Input.GetText ("ADDRESS");
local strADDRESS2 = Input.GetText ("ADDRESS2");
local strTOWN = Input.GetText ("TOWN");
local strPROV = Input.GetText ("PROV");
local strCOUNTRY = Input.GetText ("COUNTRY");
local strPOSTAL = Input.GetText ("POSTAL");
local strDAY = Input.GetText ("DAY");
local strNIGHT = Input.GetText ("NIGHT");
local strEMAIL = Input.GetText ("EMAIL");
local strEMAIL2 = Input.GetText ("EMAIL2");
local strPASS = Input.GetText ("PASS");
local strPASS2 = Input.GetText ("PASS2");
local strSUBSCRIPTION = Input.GetText ("SUBSCRIPTION");
--if strFIRST ~= "" and strLAST ~= "" and strADDRESS ~= "" and strADDRESS2 ~= "" and strTOWN ~= "" and strPROV ~= "" and strCOUNTRY ~= "" and strPOSTAL ~= "" and strDAY ~= "" and strNIGHT ~= "" and strEMAIL ~= "" and strEMAIL2 ~= "" and strPASS ~= "" and strPASS2 ~= "" and strSUBSCRIPTION ~= "" then
result = Dialog.Message("Welcome ", Enclose(strFIRST)..Enclose(strLAST)..Enclose(strSU BSCRIPTION));
--insert data into database db
SQLite.Query(db, "Insert into signup(FIRST, LAST, ADDRESS, ADDRESS2, TOWN, PROV, COUNTRY, POSTAL, DAY, NIGHT, EMAIL, EMAIL2, PASS, PASS2, SUBSCRIPTION) values("..Enclose(strFIRST)..", "..Enclose(strLAST)..", "..Enclose(strADDRESS)..", "..Enclose(strADDRESS2)..", "..Enclose(strTOWN)..", "..Enclose(strPROV)..", "..Enclose(strCOUNTRY)..", "..Enclose(strPOSTAL)..", "..Enclose(strDAY)..", "..Enclose(strNIGHT)..", ".. Enclose(strEMAIL)..", "..Enclose(strEMAIL2)..", "..Enclose(strPASS)..", "..Enclose(strPASS2)..", "..Enclose(strSUBSCRIPTION)..")",nil);
--Application.GetLastError ()
--else
--result = Dialog.Message("Notice", "You must enter all of the fields of information before you can continue with the signup process", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
thanks for any help
function PopLBFromDB()
tbReturn =SQLite.QueryToTable(db, "SELECT * FROM signup");
--clear items from listbox
--ListBox.DeleteItem("LB", LB_ALLITEMS);
--do the following if there are rows
if tbReturn and tbReturn.Rows > 0 then
for i,v in tbReturn.Data do
ListBox.AddItem ("LB", tbReturn.Data [i]["FIRST_NAME"], tbReturn.Data [i]["LAST_NAME"], tbReturn.Data [i]["ADDRESS"], tbReturn.Data [i]["ADDRESS2"], tbReturn.Data [i]["TOWN"], tbReturn.Data [i]["PROV_ST"], tbReturn.Data [i]["COUNTRY"], tbReturn.Data [i]["POSTAL"], tbReturn.Data [i]["DAY"], tbReturn.Data [i]["NIGHT"], tbReturn.Data [i]["EMAIL"], tbReturn.Data [i]["EMAIL2"], tbReturn.Data [i]["PASS"], tbReturn.Data [i]["PASS2"], tbReturn.Data [i]["SUBSCRIPTION"]);
end
end
end
function Enclose(strText)
return string.format("%q",strText);
end
function AddtoDB()
local strFIRST = Input.GetText("FIRST");
local strLAST = Input.GetText("LAST");
local strADDRESS = Input.GetText ("ADDRESS");
local strADDRESS2 = Input.GetText ("ADDRESS2");
local strTOWN = Input.GetText ("TOWN");
local strPROV = Input.GetText ("PROV");
local strCOUNTRY = Input.GetText ("COUNTRY");
local strPOSTAL = Input.GetText ("POSTAL");
local strDAY = Input.GetText ("DAY");
local strNIGHT = Input.GetText ("NIGHT");
local strEMAIL = Input.GetText ("EMAIL");
local strEMAIL2 = Input.GetText ("EMAIL2");
local strPASS = Input.GetText ("PASS");
local strPASS2 = Input.GetText ("PASS2");
local strSUBSCRIPTION = Input.GetText ("SUBSCRIPTION");
--if strFIRST ~= "" and strLAST ~= "" and strADDRESS ~= "" and strADDRESS2 ~= "" and strTOWN ~= "" and strPROV ~= "" and strCOUNTRY ~= "" and strPOSTAL ~= "" and strDAY ~= "" and strNIGHT ~= "" and strEMAIL ~= "" and strEMAIL2 ~= "" and strPASS ~= "" and strPASS2 ~= "" and strSUBSCRIPTION ~= "" then
result = Dialog.Message("Welcome ", Enclose(strFIRST)..Enclose(strLAST)..Enclose(strSU BSCRIPTION));
--insert data into database db
SQLite.Query(db, "Insert into signup(FIRST, LAST, ADDRESS, ADDRESS2, TOWN, PROV, COUNTRY, POSTAL, DAY, NIGHT, EMAIL, EMAIL2, PASS, PASS2, SUBSCRIPTION) values("..Enclose(strFIRST)..", "..Enclose(strLAST)..", "..Enclose(strADDRESS)..", "..Enclose(strADDRESS2)..", "..Enclose(strTOWN)..", "..Enclose(strPROV)..", "..Enclose(strCOUNTRY)..", "..Enclose(strPOSTAL)..", "..Enclose(strDAY)..", "..Enclose(strNIGHT)..", ".. Enclose(strEMAIL)..", "..Enclose(strEMAIL2)..", "..Enclose(strPASS)..", "..Enclose(strPASS2)..", "..Enclose(strSUBSCRIPTION)..")",nil);
--Application.GetLastError ()
--else
--result = Dialog.Message("Notice", "You must enter all of the fields of information before you can continue with the signup process", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
thanks for any help