DBWSetStringFieldDataNull

<< Click to Display Table of Contents >>

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

DBWSetStringFieldDataNull

Description

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

Syntax

Sub DBWSetStringFieldDataNull(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

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"
 DBWSetStringFieldDataNull 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

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