public void resultSetToTable(ResultSet rs, Boolean tableData) {
        //Gets the results from the employee table if the ResultSet value is null. 
        if (rs == null) {
            rs = controller.getTableData(getMenuString());
        }
        try {

            ResultSetMetaData rsmd = rs.getMetaData();

            //Creates a vector with columnnames. 
            int numberOfColumns = 5;
            if (rsmd.getColumnCount() < 5) {
                numberOfColumns = rsmd.getColumnCount();
            } else if (tableData) {
                numberOfColumns++;
            }

            Vector columnNames = new Vector();

            //Used to skip the first column (timestamp) if the resultSet contains table data. (Not meta data)
            int column = 1;
            if (tableData) {
                column++;
            }

            // Gets the name from every column
            for (; column <= numberOfColumns; column++) {
                columnNames.addElement(rsmd.getColumnLabel(column));
            }

            Vector dataRows = new Vector();

            //Gets the data from every row in the ResultSet.
            while (rs.next()) {
                Vector newRow = new Vector();

                //Used to skip the first column (timestamp) if the ResultSet contains data from a table.
                int i = 1;
                if (tableData) {
                    i++;
                }

                for (; i <= numberOfColumns; i++) {
                    newRow.addElement(rs.getObject(i));
                }

                dataRows.addElement(newRow);
            }

            //Inserts the new table model into the jtable.
            DefaultTableModel dataTableModel = new DefaultTableModel(dataRows, columnNames);
            dataTable.setModel(dataTableModel);

        } catch (SQLException ex) {
            Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, "Unable to insert resultSet in to jtable", ex);
            errorReport("Unable to insert resultSet in to jtable");
        }

    }