Hi,
I have a text field in my window, and the content gets saved to my database with no problems.
I have now noticed however, that if I use a hyphen in the text field and then try to save it to the database - it works as expected (or at least I do NOT see any error messages) until I try to populate a text area with the entry - Then I get an error message saying there is no record found?
The only code I have attached to the text field is a declare in the open event, which creates a rounded text field:
declare sub setBezelStyle lib "Cocoa" selector "setBezelStyle:" ( handle as integer, value as integer )
setBezelStyle( me.handle, 1 )
The code I use to save to the database is below:
[code] // UPDATE THE DATABASE IF BOTH TEXT FIELDS HAVE DATA
If TitleField.text <> “” And CodeField.text <> “” Then
rs.Edit
rs.field(“Title”).StringValue=TitleField.text
rs.field(“Code”).StringValue=CodeField.Text
rs.Update
// CHECK FOR DATABASE ERROR
If db.Error Then
MsgBox("Error: " + Str(db.ErrorCode) + " - " + db.ErrorMessage)
Return
Else
// COMMIT THE CHANGES
db.commit
// UPDATE THE LISTBOX
MainWindow.Timer2.mode = MainWindow.Timer2.ModeSingle
// CLOSE THE WINDOW
Self.Close
end if
End If[/code]
The code I use to display the entry in a text area is as follows:
[code] // POPULATE THE CODETEXTAREA
dim sql, selected as string
selected=Listbox1.cell(Listbox1.listindex,0)
sql=“select SRef, Title, Code from Snippets where Title=’”+selected+"’"
rs=db.SQLSelect(sql)
if rs=nil then
msgbox(“No record found.”)
self.close
else
dim s as string = DefineEncoding( rs.field(“Code”).StringValue , Encodings.UTF8 )
CodeTextArea.text=s
end if
[/code]
Does anyone have any ideas?