DBWQueryTableFieldByKey

<< Click to Display Table of Contents >>

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

DBWQueryTableFieldByKey

Description

This function provides a general way to access database information, not trusting on ADO method.
It is very useful when fetching data from other tables than DOCUMENTS/REVISION.

Syntax

Function DBWQueryTableFieldByKey(tableName, keyName, keyValue, fieldName)

Parameters

tableName

the name of a database table

keyName

the value of the field to filter on

keyValue

the value that has to match the Keyname parameter

fieldName

the field of which retrieve the value

Return Values

After calling this function check the boolean value of the okDBW variable:

TRUE

if succeeded in fetching the value

FALSE

otherwise

If okDBW is TRUE, the function returns the requested value.

See also

Function DBWQuery
Function DBWQueryRevisionByUid

Example

Sub main()
 DBWInit(TRUE)
 tableName = "EVENT_LOG"
 keyName = "EVENTID"
 keyValue = "683"
 fieldName = "ACTION_ARG"
 res = DBWQueryTableFieldByKey(tableName, keyName, keyValue, fieldName)
 if (okDBW = False) Then
  exit Sub
 Else
  DBWMsgbox res
 End if
End Sub