DBWSetStringFieldData

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Library Reference > Database >

DBWSetStringFieldData

Description

Sets, in a given table of a datasource, a string field using a key field and key value

Syntax

Sub DBWSetStringFieldData(DataSource, Table, FieldToSet, FieldValue, Key, KeyValue)

Parameters

DataSource

name of a valid datasource or
"@USEDEFAULTDATASOURCE" to force the usage of the default application datasource as returned from constant DBWorksConnectionDSN

Table

name of an existing table in the specified datasource

FieldToSet

name of the field in which the value has to be set

FieldValue

value to set

Key

field of which the value will be checked to determine the query selection

KeyValue

value that will be checked to determine which records to read

Remarks

When connecting through file DSN, it's mandatory to use the datasource declared as @USEDEFAULTDATASOURCE.

See also

Get/Set string functions

Example

'this example shows how to set a specific description value where the document has been created by a certain user.
Sub Main()
 DBWInit(TRUE)
 datasource="DBWORKS"
 table=DBWLookUp("NAME_DOCUMENT_TABLE")
 field_to_set=DBWLookUp("NAME_FIELD_DESCRIPTION")
 field_value="(made by Luca)"
 key=DBWLookUp("NAME_FIELD_CREATED_BY")
 key_value="Luca"
 DBWSetStringFieldData datasource, table, field_to_set, field_value, key, key_value
 if OkDBW = TRUE then
  DBWMsgbox "OK in setting"
 else
  DBWMsgbox "Cannot set value"
 end if
End Sub

...
 DBWSetStringFieldData "@USEDEFAULTDATASOURCE", table, field_to_set, field_value, key, key_value
...