'Declaration Public Event Error As ScriptErrorEventHandler |
public event ScriptErrorEventHandler Error |
Event Data
The event handler receives an argument of type ScriptErrorEventArgs containing data related to this event. The following ScriptErrorEventArgs properties provide information specific to this event.
| Property | Description |
|---|---|
| Exception | Gets the System.Exception instance that DbScript throws. |
| Ignore | Gets or sets whether the current error will be ignored or not. |
| Length | Gets length of statement where an error occurred. |
| LineNumber | Gets number of the line where an error occurred. |
| LinePosition | Gets position in the line where an error occurred. |
| Offset | Gets offset of statement where an error occurred. |
| StatementType | Gets type of the statement that caused an error. |
| Text | Gets SQL statement where an error occurred. |
Remarks
This event can be generated by Execute and ExecuteNext methods when an error happens.
By default, Execute method stops and returns immediately after event handler finishes. If you want to ignore the error and continue execution of the script, set ScriptErrorEventArgs.Ignore property to true.
Example
This sample demonstrates how to execute script and retrieve information about execution flow using Progress and Error events.
See Also