PDA

View Full Version : Not a string?


ChatNoir
05-31-2005, 08:21 AM
Any chance of somebody telling me what I'm doing wrong here.


function SaveForm()
local iValidity
local tValidity
local sData
local sPath

iValidity = 0;
tValidity = ListBox.GetSelected("lbxFormValidity");
for index, item in tValidity do
iValidity = iValidity + ListBox.GetItemData("lbxFormValidity", index);
end
sPath = Input.GetText("inFormPath");
sData = Crypto.Base64EncodeToString(sPath);
sSQl = "INSERT INTO forms VALUES(NULL, '"..Input.GetText("inFormVersion").."', '"..Input.GetText("inFormName").."', '"..iValidity.."', '"..Input.GetText("inFormFileName").."', '"..ComboBox.GetText("cbxFormType").."', '"..ComboBox.GetText("cbxFormFormat").."', '"..Input.GetText("inFormDescription").."' ,'"..sData.."')";
Paragraph.SetText("Paragraph1", sSQL);
SQLite.Query(db, sSQL);
Error_Check();
end


Brings up the message that the sSQL variable for the following commands is not a string.


Paragraph.SetText("Paragraph1", sSQL);
SQLite.Query(db, sSQL);


However if I switch the sSQL for those two lines with


"INSERT INTO forms VALUES(NULL, '"..Input.GetText("inFormVersion").."', '"..Input.GetText("inFormName").."', '"..iValidity.."', '"..Input.GetText("inFormFileName").."', '"..ComboBox.GetText("cbxFormType").."', '"..ComboBox.GetText("cbxFormFormat").."', '"..Input.GetText("inFormDescription").."' ,'"..sData.."')"


it works fine.

Obviously I can just create the sql statement in the sqlite command, but I don't see why it doesn't work the other way.

Cheers

csd214
05-31-2005, 09:07 AM
Doesn't you have a lower-case "L" in
sSQl = "INSERT INTO forms VALUES(NULL, '"..

Try upper-case "L" like sSQL = …..

ChatNoir
05-31-2005, 09:23 AM
Oh dear, I think I've been staring at this too long. Oh for Option Explicit!