Share via


DDRAddString

The DDRAddString function adds a string property to the discovery data record.

HRESULT DDRAddString(
  char *sName,
  char *sValue,
  int nSQLWidth,
  DWORD dwFlags
);
[Visual Basic]
Resource.DDRAddString( _
  ByVal sName As String _
  ByVal sValue As String _
  ByVal nSQLWidth As Long _
  ByVal dwFlags As Long _
)

Parameters

  • sName
    Name of the class property.
  • sValue
    Value assigned to the property. You can only enter string values from the single-byte character set.
  • nSQLWidth
    Maximum length of a string that can be assigned to this property. This value does not include the NULL character.
  • dwFlags
    Characteristics of the property, such as a key field for comparisons. Enter one or more of the following flags or a zero.
    Flag Description
    ADDPROP_GUID (Hex 2) Used only on the SMSUniqueIdentifier property. If you use ADDPROP_GUID, you must also use ADDPROP_KEY.

    Note that SMSUniqueIdentifier relates discovery data to inventory data. If you do not collect inventory information for this resource, you do not need to specify the SMSUniqueIdentifier property in your DDR.

    ADDPROP_KEY (Hex 8) Identifies this property as a key field during a comparison of this DDR with class instances in the database. If an instance in the database matches the data of the DDR key properties, the instance is updated; otherwise, a new instance is created.
    ADDPROP_NAME (Hex 44) Tells the DDM to use this property's string value for the value of the Name property. In addition, this property is automatically designated as a key (ADDPROP_KEY) property for update/create comparisons.

    Note that the Name property is one of six additional properties that are generated for you by the DDM.

    ADDPROP_NAME2 (Hex 84) Adds a Comment property to your DDR and uses the string value of your property for its value.

Return Values

If the function succeeds, the return value is S_OK.

If the DDRNew function has not been called, the return value is S_FALSE.

Remarks

Your DDR must contain one string property that specifies the ADDPROP_NAME flag. The value must uniquely identify the resource because the Name property is typically used to query resource data.

Strings longer than the maximum length specified in nSQLWidth are truncated.

You can use underscores, concatenation, or spaces for property names that contain multiple words. For example, you can specify sName as License_Number, LicenseNumber, or License Number. If you specify sName as License Number, the DDM concatenates the words, which results in LicenseNumber. However, the column name, created in the database, is License_Number. You must use the same convention when you add DDRs that create or update instances in an existing resource class.

Requirements

**  Windows NT/2000:** Requires Windows NT 4.0 or later.
**  Windows 95/98:** Requires Windows 95 or later.
**  Version:** Requires SMS 2.0.
**  Header:** Declared in SMSRsGen.h.
**  Library:** Included as a resource in SMSRsGen.dll (C/C++); SMSRsGenCtl.dll (VB).

See Also

DDRAddInteger, DDRAddStringArray