SetByName

Sets the value for the corresponding column for the DataRow. If the value for the name exists, the old value is replaced.

Syntax

ASCII Version
int setByName(DataRow* dataRow, const char* name, const char* value) 
Unicode Version
int setByName(DataRow* dataRow, const UChar* name, const
UChar* value) 

Parameters

  • Datarow - the DataRow to which this function applies
  • Name with which the specified value is to be associated
  • Value to be associated with the specified name

Exceptions

If input Blank column name or Duplicate column name, return error

Results

Returns 0 if successful or error code.

Example

ASCII Version
int nRet; 
nRet= setByName (dataRow, "City", "Austin"); 
if(nRet != SUCCESSFUL_RETURN) 
{	printf(getErrorMessage(nRet)); 
//more code 
}
Unicode Version
int nRet; 
UChar* error; 
UChar columnName[64]; 
char* columnNameStr= "City" 
UChar columnValue[64]; 
char* columnValueStr= "Austin"; 
u_charsToUChars(columnNameStr,	columnName, strlen(columnNameStr)); 
columnName [strlen(columnNameStr)]=0; 
u_charsToUChars(columnValueStr,	columnValue, strlen(columnValueStr)); 
columnValue [strlen(columnValueStr)]=0; 
nRet= setByName (dataRow,	columnName, columnValue); 
if(nRet != SUCCESSFUL_RETURN) 
{	error	= getErrorMessage(nRet); 
//more code 
}