The exception that is generated when server returns an error.
The following example generates a
UniException due to a missing database, and then displays the exception.
public void ThrowUniException()
{
string mySelectQuery = "SELECT * FROM Test.Dept";
UniConnection myConnection =
new UniConnection("Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa");
UniCommand myCommand = new UniCommand(mySelectQuery,myConnection);
try
{
myCommand.Connection.Open();
}
catch (UniException myException)
{
MessageBox.Show("Message: " + myException.Message + "\n");
}
}
Public Sub ThrowUniException()
Dim mySelectQuery As String = "SELECT * FROM Test.Dept"
Dim myConnection As New UniConnection _
("Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa")
Dim myCommand As New UniCommand(mySelectQuery, myConnection)
Try
myCommand.Connection.Open()
Catch myException As UniException
MessageBox.Show("Message: " + myException.Message + ControlChars.Cr)
End Try
End Sub