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