I have multiple databases set up to store various bits of user information that they can save and retrieve....(duh, right). For instance, the very first screen that the user sees on my application is a text field that the user can enter a persons name and save that name into one of the databases for later use. When the user wants to retrieve that name at a later time, they click a button called "saved names" and it presents them with an option menu button that then lists the contents of the database. This is nice since it is a item picker "scroller" since I am making the application for IOS. The user can simply scroll the list of saved names and choose the one they want to work with. The whole process works great and names are saved without any problems except one....When a new name is saved and listed in the option menu box, the trailing end of the name has various characters of gibberish i.e. ( e7a) so that it looks like this... John Smith7a#$@ instead of just "John Smith". This is weird, but the strange part is when you enter another name into the database and it is displayed in the option menu, the gibberish is then attached to the newest entry and the first entry looks the way it should i.e. "John Smith". So to clarify, the two entrys looks like this below:
John Smith
Mary Smith#$#@&
Here the snippets of how my tables are created, data inserted and displayed....
Code: Select all
on databaseCreateTables
## Add a contact_details table to the database
put getDatabaseID() into tDatabaseID
put "CREATE TABLE patientName (name text)" into tSQL
revExecuteSQL tDatabaseID, tSQL
end databaseCreateTables
Code: Select all
on databaseInsertContactDetails
## Insert names and email addresses into the database
put getDatabaseID() into tDatabaseID
global vName
put the label of btn "patientName" into vName
put "INSERT into patientName VALUES ('" & vName & "');" into tSQL
answer "Your entry has been saved!"
revExecuteSQL tDatabaseID, tSQL
end databaseInsertContactDetails
Code: Select all
function databaseGetContactDetails
## Query the database for contact details to be displayed in the field
put getDatabaseID() into tDatabaseID
put "SELECT * from patientName" into tSQL
put revDataFromQuery(tab,return,tDatabaseID,tSQL) into tRecords
return tRecords
end databaseGetContactDetails