Difference between revisions of "DatabaseField.StringValue"

From Xojo Documentation

m (Text replacement - "{{Deprecated" to "{{DeprecatedItem")
 
Line 1: Line 1:
{{Deprecated|version=2019r2|replacement=[[DatabaseColumn.StringValue]]}}
+
{{DeprecatedItem|version=2019r2|replacement=[[DatabaseColumn.StringValue]]}}
 
{{PropertyBox
 
{{PropertyBox
 
| name=StringValue
 
| name=StringValue

Latest revision as of 19:05, 3 September 2020

Property (As String )
aDatabaseField.StringValue = newStringValue
or
StringValue = aDatabaseField.StringValue

Supported for all project types and targets.

Used to get and set the values of String/Character field types.

Notes

If the field is not of this type, StringValue will try to return the value as a String. SQLiteDatabase converts text to UTF-8 text encoding.

When using this property to assign binary data, no encoding is added.

For situations where you need to set a database column to NULL, you should use the Value property like this:

rs.Edit
rs.Field("MyStringColumn").Value = Nil // sets to NULL in the database
rs.Update

Sample Code

Get the string value of a column in a RecordSet:

// rs is a RecordSet with a string column called "ProductName"
Dim productName As String
productName = rs.Field("ProductName").StringValue

Set the string value of a column in a RecordSet:

// rs is a RecordSet with a string column called "ProductName":
rs.Edit
rs.Field("ProductName").StringValue = "Generic Widgets"
rs.Update

See Also

SetString method.