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
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