The exception that is generated when SugarCRM returns an error.
The following example generates a
SugarException due to a non-existing table, and then displays the exception.
public void ThrowSugarException()
{
string mySelectQuery = "SELECT * FROM NONEXISTINGTABLE";
SugarConnection sugarConnection =
new SugarConnection(
"server=https://your_company.sugaropencloud.eu;user id=admin;password=AmFFA4ZryM;");
SugarCommand sugarCommand = new SugarCommand(mySelectQuery,sugarConnection);
try
{
sugarCommand.Connection.Open();
}
catch (SugarException myException)
{
MessageBox.Show("Message: " + myException.Message + "\n");
}
}
Public Sub ThrowSugarException()
Dim mySelectQuery As String = "SELECT * FROM NONEXISTINGTABLE"
Dim sugarConnection As New SugarConnection( _
"server=https://your_company.sugaropencloud.eu;user id=admin;password=AmFFA4ZryM;")
Dim sugarCommand As New SugarCommand(mySelectQuery, sugarConnection)
Try
sugarCommand.Connection.Open()
Catch myException As SugarException
MessageBox.Show("Message: " + myException.Message + ControlChars.Cr)
End Try
End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2