Getting a table name

This sample retrieves the name of the Contact table for the given real field name. It is useful in cases where the Act! database contains a large number of custom fields and additional Contact tables. The sample shows the following tasks:

/// <summary>

/// Retrieves name of the Contact table of given field if there are lot of custom fields and additional Contact tables

/// </summary>

/// <param name="dbFieldName">real name of the field</param>

/// <returns>table name as string if field exist in database; otherwise return empty string</returns>

private string GetTableName(string dbFieldName)

{

ActFramework ACTFM = new ActFramework();

ACTFM.LogOn("C:\\Documents and Settings\\Administrator\\My Documents\\ACT\\Act for Win 8\\Databases\\Act8Demo.pad", "Chris Huffman","");

ContactFieldDescriptor[] cfd = ACTFM.Contacts.GetContactFieldDescriptors();

for(int i=0; i < cfd.Length; i++)

{

if ( dbFieldName.Equals(cfd[i].ColumnName) )

return cfd[i].TableName;

}

return "";

}