Returns the error code of the last database error that occurred in the Web DataWindow server component.
DataWindow type |
Method applies to |
---|---|
Web |
Server component |
Web DataWindow server component
long dwcontrol.GetLastError ( )
Argument |
Description |
---|---|
dwcontrol |
A reference to the DataWindow server component |
Returns a numeric error code for the last database error that occurred.
If dwcontrol is null, the method returns null.
Call GetLastError and GetLastErrorString to get information about database errors that caused SetAction, Update, Retrieve, and RetrieveEx to return –1.
This code in a page server script calls Retrieve for the Web DataWindow server component called dwComponent and gets information about the database error if Retrieve fails:
retVal = dwComponent.Retrieve( );
if (retVal < 0) {
Response.Write("Retrieval error: "
+ dwComponent.GetLastError( )
+ "<BR>"
+ dwComponent.GetLastErrorString( )
+ "<BR>");
}