Difference between revisions of "DatabaseField.PictureValue"

From Xojo Documentation

Line 9: Line 9:
 
| platform=all
 
| platform=all
 
}}
 
}}
 
 
{{Description
 
{{Description
 
|text=Gets or sets the PictureValue using the specified picture format. }}
 
|text=Gets or sets the PictureValue using the specified picture format. }}
 
  
 
{{PropertyBox
 
{{PropertyBox
Line 23: Line 21:
 
| platform=all
 
| platform=all
 
}}
 
}}
 
 
{{Description
 
{{Description
 
|text=Gets or sets the PictureValue. }}
 
|text=Gets or sets the PictureValue. }}
  
 
== Notes ==
 
== Notes ==
 +
For most databases you will want to use the NativeValue property instead.
 +
 
For situations where you need to set a database column to NULL, you should use the Value property like this:
 
For situations where you need to set a database column to NULL, you should use the Value property like this:
 
 
<rbcode>
 
<rbcode>
 
rs.Edit
 
rs.Edit
Line 36: Line 34:
 
</rbcode>
 
</rbcode>
  
==Example==
+
== Sample Code ==
 
 
 
Get the picture value of a column in a [[RecordSet]]:
 
Get the picture value of a column in a [[RecordSet]]:
 
 
<rbcode>
 
<rbcode>
 
// rs is a RecordSet with a picture column called "ProductImage"
 
// rs is a RecordSet with a picture column called "ProductImage"
Line 45: Line 41:
 
productImage = rs.Field("ProductImage").PictureValue
 
productImage = rs.Field("ProductImage").PictureValue
 
</rbcode>
 
</rbcode>
 
  
 
Set the picture value of a column in a [[RecordSet]]:
 
Set the picture value of a column in a [[RecordSet]]:
 
 
<rbcode>
 
<rbcode>
 
// rs is a RecordSet with a picture column called "ProductImage":
 
// rs is a RecordSet with a picture column called "ProductImage":
Line 55: Line 49:
 
rs.Update
 
rs.Update
 
</rbcode>
 
</rbcode>
 
  
 
Get the picture value of a column in a [[RecordSet]], converting it to JPEG:
 
Get the picture value of a column in a [[RecordSet]], converting it to JPEG:
 
 
<rbcode>
 
<rbcode>
 
// rs is a RecordSet with a picture column called "ProductImage"
 
// rs is a RecordSet with a picture column called "ProductImage"

Revision as of 21:25, 23 January 2019

Property (As Picture )
aDatabaseField.PictureValue(Format as String=Picture.FormatPNG,quality as Integer= Picture.QualityDefault) = newPictureValue
or
PictureValue = aDatabaseField.PictureValue(Format as String=Picture.FormatPNG,quality as Integer= Picture.QualityDefault)

New in 2011r2

Supported for all project types and targets.

Gets or sets the PictureValue using the specified picture format.

Property (As Picture )
aDatabaseField.PictureValue = newPictureValue
or
PictureValue = aDatabaseField.PictureValue

New in 2011r2

Supported for all project types and targets.

Gets or sets the PictureValue.

Notes

For most databases you will want to use the NativeValue property instead.

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

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

Sample Code

Get the picture value of a column in a RecordSet:

// rs is a RecordSet with a picture column called "ProductImage"
Dim productImage As Picture
productImage = rs.Field("ProductImage").PictureValue

Set the picture value of a column in a RecordSet:

// rs is a RecordSet with a picture column called "ProductImage":
rs.Edit
rs.Field("ProductImage").PictureValue = Canvas1.Backdrop
rs.Update

Get the picture value of a column in a RecordSet, converting it to JPEG:

// rs is a RecordSet with a picture column called "ProductImage"
Dim productImage As Picture
productImage = rs.Field("ProductImage").PictureValue(Picture.FormatJPEG)