PDA

View Full Version : Load column records into input object (with multiline enabled) or paragraph object.


sside
10-06-2004, 11:01 AM
Hello everybody

I'm trying to load the records (SQLite database) of a column into a input object (with multiline enabled) or paragraph object. If i have to insert it into a listbox object it would be like this;
************************************************** *****
ResultSearch = SQLite.QueryToTable(db, "SELECT FirstName FROM contacts");

for n=1, ResultSearch.Rows do
ListBox.AddItem("ListBox1", ResultSearch.Data[n]["FirstName"], "");
end
************************************************** *****
But if i use the same code to insert the results into input object (with multiline enabled) or paragraph object it will show only the last record of the search result;
************************************************** *****
ResultSearch = SQLite.QueryToTable(db, "SELECT FirstName FROM contacts");

for n=1, ResultSearch.Rows do
Input.SetText("Input1", ResultSearch.Data[n]["FirstName"]);
end
************************************************** *****
or
************************************************** *****
ResultSearch = SQLite.QueryToTable(db, "SELECT FirstName FROM contacts");

for n=1, ResultSearch.Rows do
Paragraph.SetText("Paragraph1", ResultSearch.Data[n]["FirstName"]);
end
************************************************** *****
So my question is how can this be solved?

Thanks a lot

Sside

Dermot
10-06-2004, 12:30 PM
Try this

for n=1, ResultSearch.Rows do
contacts = contacts .. ResultSearch.Data[n]["FirstName"]) .. "\r\n";
end
Paragraph.SetText("Paragraph1", contacts)

Dermot

sside
10-06-2004, 12:38 PM
Hello Dermot

Thanks for your time but it doesn't work. A error shows up

Attempt to concatenate global "contacts" (nil value)


Thank you

Sside

TJ_Tigger
10-06-2004, 01:02 PM
Try setting the value of contacts before you use it

contacts = ""
for n=1, ResultSearch.Rows do
contacts = contacts .. ResultSearch.Data[n]["FirstName"]) .. "\r\n";
end
Paragraph.SetText("Paragraph1", contacts)

sside
10-06-2004, 01:40 PM
Thanks TJ_Tigger

It works

Thanks a lot

Sside