private void displayResultSetsInDialog(final JFrame frame, String sql) throws SQLException {
		StringBuilder warnings = new StringBuilder();
		StringBuilder text = new StringBuilder();
		Statement statement = SybaseBuddyApplication.connection.createStatement();
		boolean results = statement.execute(sql);
		int rowsAffected = 0;
		do {
			if (results) {
				ResultSet resultSet = statement.getResultSet();
				ResultSetMetaData metaData = resultSet.getMetaData();
				int numColumns = metaData.getColumnCount();
				while (resultSet.next()) {
					StringBuilder row = new StringBuilder();
					for (int i = 1; i <= numColumns; i++) {
						if (i > 1) {
							row.append("\t");
						}
						row.append(resultSet.getString(i));
					}
					text.append(row.toString()).append("\n");
				}
			} else {
				rowsAffected = statement.getUpdateCount();
			}
			SQLWarning sqw = statement.getWarnings();
			while ((sqw != null) && (sqw instanceof SybSQLWarning)) {
				warnings.append(sqw.getMessage());
				sqw = sqw.getNextWarning();
			}
			statement.clearWarnings();
			results = statement.getMoreResults();
		} while (results || (rowsAffected != -1));
		System.out.println(warnings);
		displayTextAreaDialog(frame, text.toString());
	}