SQLError Function Example

This example generates an intentional error by attempting to open a connection to the Northwind database by using an incorrect connection string (Northwind is misspelled). The error information is displayed on Sheet1.

chan = SQLOpen("DSN=Nortwind")
returnArray = SQLError()
For i = LBound(returnArray, 1) To UBound(returnArray, 1)
    Worksheets("Sheet1").Cells(1, i).Formula = returnArray(i)
Next i
SQLClose chan