If the database file does not exist on the server, or the sql query is invalid then a table with no header/rows is added to the document.  Replace this with an error in place of the table.