WriteFieldValue - method of the PmaDatabase object
Description:
Method sets the value of the column or all columns (defined in the
vField parameter) of the current row (defined for example by calling the
Move method).
Syntax:
Boolean WriteFieldValue(Variant vField, Variant vValue)
Parameters:
vField | (Variant) Column name of the table or its index (zero-based index).
If not set, then the method writes into the whole row of the table the variable of the Array type.
If is -3 then sets the whole table row from the array of values. |
vValue | (Variant) The new value to be written. |
---|
Return value:
true - on success
false - on error
Example1:
JavaScriptVBScriptSelect and copy to clipboard
var oDb = pMe.Pm("/Database0");
if (oDb.IsOpen())
{
// writing to column named "column1" and the first row of the table
oDb.MoveFirst();
oDb.WriteFieldValue("column1", 100);
// writing to the 1st column and the 2nd row of the table
oDb.MoveNext();
oDb.WriteFieldValue(0, 100);
}
Dim oDb
Set oDb = pMe.Pm("/Database0")
If oDb.IsOpen() Then
' writing to column named "column1" and the first row of the table
oDb.MoveFirst
oDb.WriteFieldValue "column1", 100
' writing to the 1st column and the 2nd row of the table
oDb.MoveNext
oDb.WriteFieldValue 0, 100
End If
Example2:
Writing into more columns in the 1st row of the table by the
Edit method.
In this case it is the better way than to call the
WriteFieldValue method repeatedly without the
Edit.
JavaScriptVBScriptSelect and copy to clipboard
if (oDb.IsOpen())
{
oDb.MoveFirst();
oDb.Edit();
oDb.WriteFieldValue(0, 1);
oDb.WriteFieldValue(1, 12);
oDb.WriteFieldValue(2, "Text");
oDb.Update();
}
If oDb.IsOpen() Then
oDb.MoveFirst
oDb.Edit
oDb.WriteFieldValue 0, 1
oDb.WriteFieldValue 1, 12
oDb.WriteFieldValue 2, "Text"
oDb.Update
End If
Example3:
Writing into more columns in the first row of the table by the Array of values.
JavaScriptVBScriptSelect and copy to clipboard
if (oDb.IsOpen())
{
var arr = Pm.Array1(1, 12, "Note");
oDb.MoveFirst();
oDb.WriteFieldValue(-3, arr);
}
If oDb.IsOpen() Then
Dim arr
arr = Pm.Array1(1, 12, "Note")
oDb.MoveFirst
oDb.WriteFieldValue -3, arr
End If