The exception that is generated when an error is returned by the Mimer Data Provider.
The following table has a primary key constraint called PK1: CREATE TABLE TAB1(C1 INTEGER, C2 DATE, CONSTRAINT PK1 PRIMARY KEY(C1))
No example is available for C++ or JScript. To view a C# example, click the Language Filter button in the upper-left corner of the page.
MimerCommand command = new MimerCommand();
command.CommandText = "INSERT INTO TAB1 VALUES(1, DATE '2008-12-01')";
command.Connection = connection;
try {
command.ExecuteNonQuery()
} catch (MimerException ex) {
if (ex.Errors.Count > 0 && ex.Errors[0].ConstraintName == "PK1") {
Console.WriteLine("Duplicate primary key");
} else {
Console.WriteLine("Error message: " + ex.Message);
}
}
Dim command As New MimerCommand
command.CommandText = "INSERT INTO TAB1 VALUES(1, DATE '2008-12-01')"
command.Connection = connection
Try
command.ExecuteNonQuery()
Catch ex As MimerException
If ex.Errors.Count > 0 And ex.Errors(0).ConstraintName == "PK1" Then
Console.WriteLine("Duplicate primary key")
Else
Console.WriteLine("Error message: " + ex.Message)
End If
End Try
.NET Framework
Version 2.0 or later