AddColumn

Adds the new column.

Syntax

ASCII Version
int addColumn(DataTable* dataTable, const char* columnName,
int* indexReturn) 
Unicode Version
int addColumn(DataTable* dataTable, const UChar* columnName,
int* indexReturn) 

Parameters

  • Datatable - the DataTable to which this function applies
  • Column name to be added to the DataTable
  • Returns the corresponding index

Results

Returns 0 if successful or error code.

Exceptions

  • Blank column name
  • Duplicate column name

Example

ASCII Version
int nIndex; 
int nRet; 
nRet= addColumn( dataTable, "AddressLine1", &nIndex); 
nRet= addColumn( dataTable, "City",&nIndex); 
nRet= addColumn( dataTable, "State", &nIndex); 
if(nRet != SUCCESSFUL_RETURN) 
{ 
printf(getErrorMessage(nRet)); 
return ; 
}
Unicode Version
int nRet; 
int nIndex; 
UChar* error; 
UChar city[64]; 
char* cityString= "City" 
u_charsToUChars(cityString,	city,	strlen(cityString)); 
city[ strlen(cityString)]=0; 

nRet= addColumn( dataTable, city,&nIndex); 
if(nRet != SUCCESSFUL_RETURN) 
{ 
error = getErrorMessage(nRet); 
//more code 
}