Display next result in a recordset

Hi everyone,
I'm building an ASP page (working with MS Access and DWCS3)
and want to use the top three results from a query as dynamic
elements of my page but I need to be able to work with the 1st, 2nd
and 3rd items in the recordset separately.
The records in my table have an autonumber primary key. If
that's all I was working with, I'd create three recordsets using
MAX ID, MAX ID -1, and MAX ID - 2. However, I need to use a filter
condition that won't let me do that. My resulting IDs might be 12,
5 and 2, for instance.
Any suggestions?
Regards,
--NewDevGuy

NewDevGuy wrote:
> Awesome. I was able to make this work. Thanks very much
for the help. In
> hindsight, I see now that I've been using complex SQL
and multiple recordsets
> to manipulate data when a VB script command (which I
only know through building
> sites with DW), as in this case, would be a better
solution.
>
> Now that I've gotten this to work, I now have a new
wrinkle to figure out. I
> want to apply a 'show region if'-type behavior depending
on the value in a
> column. Let's say the values are "0" and "-1" (based on
a checkbox from a
> form). The 'show region if' behaviors built into DW are
based on recordsets.
> Now that I'm only working with one recordset, I'm not
sure how to do this.
>
> If you have any tips on how I can show "A" if the column
value is 0 or "B" if
> the column value is -1, I'll be doubly grateful.
There are a couple ways to approach this, both are simple.
1. Advanced Conditional Region Extension:
http://www.dmxzone.com/ShowDetail.asp?NewsId=553
2. Drag your recordset binding onto the page, it will look
like this:
<%= rsRecordSet.Fields.Item("YourColumn").Value %>
Change it to:
<% If rsRecordSet.Fields.Item("YourColumn").Value = 0 Then
%>A<% End if %>
<% If rsRecordSet.Fields.Item("YourColumn").Value = -1
Then %>B<% End if %>
3. Do it in your SQL using a CASE statement, here is a
simplified version:
SELECT CASE YourColumn WHEN 0 THEN A WHEN -1 THEN B END AS
YourNewColumn
FROM YourTable
I always go for the SQL route, its tidier, and fairly easy
once you
understand CASE. I am assuming that you are using Access,
which I am not
sure if it supports CASE.
Dooza
Posting Guidelines
http://www.adobe.com/support/forums/guidelines.html
How To Ask Smart Questions
http://www.catb.org/esr/faqs/smart-questions.html

Similar Messages

  • SQL*plus not displaying the result of XMLELEMENT

    HI,
    I am using SQL*Plus: Release 10.1.0.4.2
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    When I run the following query in SQL*PLUS, I get nothing displayed. However when I run the same query connecting to the same database using SQL Developer then I get the result
    SQL> select XMLELEMENT("form_id",form_id)
    2 FROM collections;
    XMLELEMENT("FORM_ID",FORM_ID)
    In SQL developer
    <form_id>101</form_id>
    I set long and longchuncksize to 32K , and I change linesize, pages, but nothing helped
    Is there any configuration that I have to do, so that SQL*plus display the result of “ select XMLELEMENT("form_id",form_id) query.
    Appreciate you help, thanks

    From a fresh start ;) :
    SQL*Plus: Release 10.1.0.4.2 - Production on Fri Feb 26 15:29:04 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select xmlelement("value", a.object_name )
      2  from   all_objects a
      3  where  rownum <= 5;
    XMLELEMENT("VALUE",A.OBJECT_NAME)
    SQL> select xmlelement("value", (select b.object_name
      2                              from   all_objects b
      3                              where b.object_name = a.object_name
      4                              )
      5                   )
      6  from   all_objects a
      7  where  rownum <= 5;
    XMLELEMENT("VALUE",(SELECTB.OBJECT_NAMEFROMALL_OBJECTSBWHEREB.OBJECT_NAME=A.OBJE
    <value>ICOL$</value>
    <value>I_USER1</value>
    <value>CON$</value>
    <value>UNDO$</value>
    <value>C_COBJ#</value>
    SQL> show all
    appinfo is OFF and set to "SQL*Plus"
    arraysize 15
    autocommit OFF
    autoprint OFF
    autorecovery OFF
    autotrace OFF
    blockterminator "." (hex 2e)
    btitle OFF and is the first few characters of the next SELECT statement
    cmdsep OFF
    colsep " "
    compatibility version NATIVE
    concat "." (hex 2e)
    copycommit 0
    COPYTYPECHECK is ON
    define "&" (hex 26)
    describe DEPTH 1 LINENUM OFF INDENT ON
    echo OFF
    editfile "afiedt.buf"
    embedded OFF
    escape OFF
    FEEDBACK ON for 6 or more rows
    flagger OFF
    flush ON
    heading ON
    headsep "|" (hex 7c)
    instance "local"
    linesize 80
    lno 9
    loboffset 1
    logsource ""
    long 80
    longchunksize 80
    markup HTML OFF HEAD "<style type='text/css'> body {font:10pt Arial,Helvetica,sans-serif; color:blac
    newpage 1
    null ""
    numformat ""
    numwidth 10
    pagesize 14
    PAUSE is OFF
    pno 1
    recsep WRAP
    recsepchar " " (hex 20)
    release 1002000300
    repfooter OFF and is NULL
    repheader OFF and is NULL
    serveroutput OFF
    shiftinout INVISIBLE
    showmode OFF
    spool OFF
    sqlblanklines OFF
    sqlcase MIXED
    sqlcode 0
    sqlcontinue "> "
    sqlnumber ON
    sqlpluscompatibility 10.1.0
    sqlprefix "#" (hex 23)
    sqlprompt "SQL> "
    sqlterminator ";" (hex 3b)
    suffix "sql"
    tab ON
    termout ON
    timing OFF
    trimout ON
    trimspool OFF
    ttitle OFF and is the first few characters of the next SELECT statement
    underline "-" (hex 2d)
    USER is "HR"
    verify ON
    wrap : lines will be wrapped
    SQL>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Php site search displays no results

    Hi I followed this tut, http://www.pixeldigest.com/phpsearch.html
    There are 2 pages, the search page with text box and submit button, and the results page. When clicking on the submit button, it takes you to the search result page but no data is displayed :< My database is connected and everything, also when adding the recordset the 'test' works and displays the results.
    If some1 could help would be great.
    Thanks
    Here's the code:
    Search page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>search</title>
    </head>
    <body>
    <form id="fmsearch" name="fmsearch" method="get" action="search_result.php">
      <label for="search">search</label>
      <input type="text" name="search" id="search" />
      <label for="submit">submit</label>
      <input type="submit" name="submit" id="submit" value="Submit" />
    </form>
    </body>
    </html>
    Result page:
    <?php require_once('Connections/search_db.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
    $colname_Recordset1 = "-1";
    if (isset($_GET['name'])) {
      $colname_Recordset1 = $_GET['name'];
    mysql_select_db($database_search_db, $search_db);
    $query_Recordset1 = sprintf("SELECT * FROM resturants WHERE name = %s", GetSQLValueString($colname_Recordset1, "text"));
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $search_db) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>search result</title>
    </head>
    <body>
    <?php do { ?>
      <table width="636" border="1" cellspacing="0" cellpadding="0">
        <tr>
          <th height="289" scope="col"><?php echo $row_Recordset1['id']; ?><?php echo $row_Recordset1['name']; ?><br />      <?php echo $row_Recordset1['location']; ?><br /></th>
        </tr>
      </table>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset1);
    ?>

    Hi
    Change this -
    <?php do { ?>
      <table width="636" border="1" cellspacing="0" cellpadding="0">
        <tr>
          <th height="289" scope="col"><?php echo $row_Recordset1['id']; ?><?php echo $row_Recordset1['name']; ?><br />      <?php echo $row_Recordset1['location']; ?><br /></th>
        </tr>
      </table>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
    to -
      <table width="636" border="1" cellspacing="0" cellpadding="0">
    <?php do { ?>
        <tr>
          <td> <?php echo $row_Recordset1['id']; ?> <br /> <?php echo $row_Recordset1['name']; ?> <br /> <?php echo $row_Recordset1['location']; ?> </td>
        </tr>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
      </table>
    PZ

  • How to display the results of the grouping horizontally

    Hello,
    I still cannot understand what am I doing wrong when trying to display the results of the grouping horizontally. Here is the original thread: How to group report vertically
    In the Section expert, for Detail section, I check the box Format with Multiple columns. Under the Layout tab, I check Format groups with multiple columns and set the width of the column at 3.3 in. This should give me 3 columns for Landscape orientation.
    Now if I select Printing direction Down then Across, I just have the regular vertical grouping.
    If I check Across then Down, then I do get 3 columns, but all the records in the Detail section are also spread across first instead of staying in the column.
    There should be something else that I should do to get the display like this:
    Header1    Header2    Header3
    record11   record21   record31
    record12   record22   record32
    record13   record23   record33
    etc.            etc.            etc.
    Thank you.

    I'm not at all sure columns are gonna help here, as there is no way that I am aware of to tell Crystal to start a new column.
    The only way that I can think of to achieve what you are trying to accomplish is to do something like this:
    In your group header's Suppress formula, keep track of the first (/ next) three groups that you want to print, using something like (basic syntax):
    global grouplist(3) as string
    global groupcount as number
    groupcount = groupcount + 1
    grouplist(groupcount) = {db.GroupingField}
    ' The NextIsNull below implies End-of-Data...
    if groupcount = 3 or NextIsNull({db.GroupField}) then
      formula = false  ' print the group header
    else
      formula = true  ' suppress the group header
    end if
    Then, create three formula fields to get each value in grouplist().  The group header format will then show the three formula fields.  Underneath these three formula fields, add subreports, which will show the details for one specific group.  The subreports should have a parameter for which group's details to show.  Use the three formula fields as the link to the three subreports.
    In the group footer, clear out the grouplist() array, and set groupcount to zero.
    This report will take a while to run, because having three subreports next to each other makes it difficult for Crystal to determine page formatting.
    HTH,
    Carl

  • Servlet could nt able to Display the Result Page By Page ( Paging Problem)

    Hi, I want to display my result set Page by page... i wrote the code but it is not working properly... just it is showing intial record page(i.e 0 to 5) and page number links, But when i click on those number hyper links, just it is coming empty pages...
    plz help me out Thanks a lot in advance..... and my code is
    package tauvex;
    import java.io.*;
    import java.net.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.sql.DriverManager.*;
    public class TauvexDataServlet extends HttpServlet {
    Connection con=null;
    Statement statement=null;
    ResultSet resultset=null;
    public void init(ServletConfig config) throws ServletException {
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://localhost/fitstestdb","root","");
    } catch (ClassNotFoundException ex) {
    System.err.println("ClassNotFoundException: " + ex.getMessage());
    throw new ServletException("Class not found Error");
    } catch(java.lang.InstantiationException ie) {
    System.out.println("instantiation exp:"+ie);
    } catch(java.lang.IllegalAccessException ia) {
    System.out.println("illegalaccess exp:"+ia);
    } catch (SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    protected void processRequest(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    +*// From Here My problem Starts*_+ 
    // Code For Paging starts
    int pages=0;
    try{
    Connection ocon = null;
    Class.forName("com.mysql.jdbc.Driver");
    ocon = DriverManager.getConnection("jdbc:mysql://localhost/fitstestdb","root","");
    Statement stmtt = ocon.createStatement();
    ResultSet rc = stmtt.executeQuery("Select count(*) from FitsData ");
    rc.next();
    pages = rc.getInt(1);
    out.println("Count of Records : " + pages + "<br>");
    catch (ClassNotFoundException ex) {
    System.err.println("ClassNotFoundException: " + ex.getMessage());
    throw new ServletException("Class not found Error");
    } catch (SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    int cPage;
    cPage = (pages / 5) + 1;
    if ((cPage * 5) + 1 >= pages)
    cPage++;
    out.println("Count of Pages : " + (cPage - 1) + "<br><p><p>");
    int p;
    for(p = 1; p < cPage ; p++)
    out.println("<a href=TauvexDataServlet?mv=" + p + ">"+ p +"</a> | ");
    out.println("<hr>");
    // paging
    int cpage;
    int currentRs;
    String pt;
    pt = request.getParameter("mv");
    if (pt == null)
    currentRs = 0;
    else
    cpage = Integer.parseInt((String)pt);
    currentRs = 5 * (cpage - 1);
    out.println(cpage + "<br>");
    //Paging Code End here
    *// My problem ends here ...!!!*
    String RA=new String();
    String DEC=new String();
    String DATE=new String();
    String DATE1=new String();
    String FILTER=new String();
    String Radious=new String();
    String ShowRA=null;
    String ShowDEC=null;
    String ShowFile=null;
    String ShowQuery=null;
    String ObservationDates=null;
    String Telescope=null;
    String Filter=null;
    RA=request.getParameter("RA");
    DEC=request.getParameter("DEC");
    DATE=request.getParameter("DATE");
    DATE1=request.getParameter("DATE1");
    FILTER=request.getParameter("FILTER");
    Radious=request.getParameter("Radious");
    ShowRA=request.getParameter("ShowRA");
    ShowDEC=request.getParameter("ShowDEC");
    ShowFile=request.getParameter("ShowFile");
    ShowQuery=request.getParameter("ShowQuery");
    ObservationDates=request.getParameter("ObservationDates");
    Telescope=request.getParameter("Telescope");
    Filter=request.getParameter("Filter");
    String query = "SELECT * " +
    " FROM FitsData limit "+currentRs+",5;";
    try {
    Statement statement=con.createStatement();
    ResultSet resultset=statement.executeQuery(query);
    if(ShowQuery != null && "on".equals(ShowQuery))
    out.println("<font size=4 color=black>The Selected Query is :</font><br/>");
    out.println("<font>");
    out.println(query);
    out.println("</font>");
    out.println("<hr>");
    if(resultset.next()!=false) {
    out.println("<html><head>");
    out.println("</head><body>");
    out.println("<table cellspacing=1 cellpadding=1 border=1>");
    out.println("<tr>");
    if(ShowFile != null && "on".equals(ShowFile))
    out.println("<td> Filename </td>");
    if(ShowRA != null && "on".equals(ShowRA))
    out.println("<td> RA_START </td>");
    if(ShowRA != null && "on".equals(ShowRA))
    out.println("<td> RA_END </td>");
    if(ShowDEC != null && "on".equals(ShowDEC))
    out.println("<td> DEC_START </td>");
    if(ShowDEC != null && "on".equals(ShowDEC))
    out.println("<td> DEC_END </td>");
    if(Telescope!=null && "on".equals(Telescope))
    out.println("<td> TELESCOPE </td>");
    if(ObservationDates !=null && "on".equals(ObservationDates))
    out.println("<td> STARTOBS </td>");
    if(ObservationDates !=null && "on".equals(ObservationDates))
    out.println("<td> ENDOBS </td>");
    if(Filter!=null && "on".equals(Filter))
    out.println("<td> FILTER </td>");
    out.println("</tr>");
    while(resultset.next())
    Object o1 = resultset.getObject(1);
    Object o2 = resultset.getObject(2);
    Object o3 = resultset.getObject(3);
    Object o4 = resultset.getObject(4);
    Object o5 = resultset.getObject(5);
    Object o6 = resultset.getObject(6);
    Object o7 = resultset.getObject(7);
    Object o8 = resultset.getObject(8);
    Object o9 = resultset.getObject(9);
    out.println("<tr>");
    if(ShowFile != null && "on".equals(ShowFile) && o1 != null)
    out.println("<td>"+o1+"</td>");
    if(ShowRA != null && "on".equals(ShowRA) && o2 != null)
    out.println("<td>"+o2+"</td>");
    if(ShowRA != null && "on".equals(ShowRA) && o3 != null)
    out.println("<td>"+o3+"</td>");
    if(ShowDEC != null && "on".equals(ShowDEC) && o4 != null)
    out.println("<td>"+o4+"</td>");
    if(ShowDEC != null && "on".equals(ShowDEC) && o5 != null)
    out.println("<td>"+o5+"</td>");
    if(Telescope!=null && "on".equals(Telescope) && o6!=null)
    out.println("<td>"+o6+"</td>");
    if(ObservationDates !=null && "on".equals(ObservationDates) && o7!=null)
    out.println("<td>"+o7+"</td>");
    if(ObservationDates !=null && "on".equals(ObservationDates) && o8!=null)
    out.println("<td>"+o8+"</td>");
    if(Filter!=null && "on".equals(Filter) && o9!=null)
    out.println("<td>"+o9+"</td>");
    out.println("</tr>");
    out.println("</table>");
    out.println("<br>");
    out.println("</body>");
    out.println("</html>");
    else {
    out.println("NO MATCHING RECORDS FOUND");
    } catch(java.sql.SQLException sqle) {
    System.out.println("sql exception:"+sqle);
    out.close();
    protected void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    protected void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    public String getServletInfo() {
    return "Short description";
    }

    I also did a Servlet Paging but I later found a Paging example that used MVC architecture which I found to be more efficient.
    This post has a good example in this link: http://forums.devshed.com/java-help-9/paging-in-jsp-85968.html?p=382695#post382695
    After I downloaded the example I made alot of changes and got rid of the scriptlets in the JSP and brought it more up to date using JSTL.
    Also check out a pre-built tag: http://displaytag.sourceforge.net/

  • Can't get the table display my results

    OK After some good hours of debugging i am able to display my results on JTable for my queries. But i got another problem now. When i select Query2 from my JComboBox and click on execute button nothing happens, same thing for query3 and 4. The only thing which works is QUERY1 why? what am i doing wrong?
    import java.awt.FlowLayout;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableModel;
    import java.awt.event.ActionEvent;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import java.util.Vector;
    public class DatabaseProgramming extends JFrame implements ActionListener{
         static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
         static final String DATABASE_URL = "jdbc:mysql://localhost/employees";
         static final String USERNAME = "jhtp6";
         static final String PASSWORD = "jhtp6";
         private static final String QUERY1 = "SELECT * FROM employees WHERE DEPARTMENTNAME = 'SALES'";
         private static final String QUERY2 = "SELECT * FROM hourlyEmployees WHERE hours >= '30'";
         private static final String QUERY3 = "SELECT * FROM commissionEmployees ORDER BY commissionRate DESC";
         private String names[] = {"QUERY1", "QUERY2", "QUERY3", "QUERY4"};
         private Connection connection;
         private ResultSet resultSet;
         private Statement statement;
         private ResultSetMetaData metaData;
         private JTable resultTable;
         private JComboBox queryBox;
         private JButton button;
         private int number;
         private boolean connectedDatabase = false;
         private DefaultTableModel dtm;
         public static void main(String[] args) {
              DatabaseProgramming frame = new DatabaseProgramming();
              frame.setVisible(true);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public DatabaseProgramming() {
              super("Testing Database");
              setLayout(new FlowLayout());
              //dtm = new DefaultTableModel(getColumnName(number),0);
              //     statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                   //         ResultSet.CONCUR_READ_ONLY);
              queryBox = new JComboBox(names);
              queryBox.setEditable(false);
                   //queryBox.addActionListener(this);
                   button = new JButton("EXECUTE");
                   resultTable = new JTable();
                   button.addActionListener(this);
                   add(queryBox);
                   add(button);
                   add(resultTable);
                   //add(result);
                   setSize(400,400);
          public void actionPerformed(ActionEvent e)  {
              String selection = (String)queryBox.getSelectedItem();
                        if(selection.equals(names[0]))
                        validateQuery(QUERY1);
                        if(selection.equals(QUERY2))
                             validateQuery(QUERY2);
                        if(selection.equals(QUERY3))
                             validateQuery(QUERY3);
          public void validateQuery(String query) {
                   try {
                        Class.forName(JDBC_DRIVER);
                        connection = DriverManager.getConnection(DATABASE_URL, USERNAME, PASSWORD);
                        System.out.println("Yay Database Connected");
                    Vector col = new Vector();
                    Vector data = new Vector();
               statement = connection.createStatement();
                  resultSet = statement.executeQuery(query);
                  metaData = resultSet.getMetaData();
                  number = metaData.getColumnCount();
                  for(int i=1; i<=number; i++)
                       col.addElement(metaData.getColumnName(i));
                  while(resultSet.next()) {
                       Vector row = new Vector();
                       for(int i=1; i<=number; i++)
                            row.addElement(resultSet.getObject(i));
                       data.addElement(row);
                 resultTable.setModel(new DefaultTableModel(data,col));
                 resultTable.revalidate();
               catch ( SQLException sqlException )
                  sqlException.printStackTrace();
                  System.exit( 1 );
               catch(ClassNotFoundException e) {
                    e.printStackTrace();
               finally
                  try                                                       
                     statement.close();                                     
                     connection.close();                                    
                  catch ( SQLException sqlException )
                     JOptionPane.showMessageDialog( null,
                        sqlException.getMessage(), "Database error",
                        JOptionPane.ERROR_MESSAGE );
                     System.exit( 1 );
    }

    One last question how can i display the columnName on my JTable? Add the table to a scroll pane and the scroll pane to the frame.

  • How can I display all results of a array element in a TS2.0 NumericArrayMeasurement in a single report line?

    TestStand2.0 generates for each result property ( data, limits, status...) of each array element in a NumericArrayTest an extra line in the test report.
    How can I change this to display all result properties of one array element in a single line?
    How can I reduce the spaces between the property name and its value in the report?
    How can I delete the message: "Measurement[x]" and display only the Measurement Alias (named in the Edit Limits menu)?
    This means I like to change my report from:
    Measurement[0] (ADC1):
    Data: 5000
    Status: Passed
    Measurement[1] (AD
    C2):
    To:
    ADC1: Data: 5000 Status: Passed
    ADC2: ...

    Hi,
    What you can do, is use the Override Callbacks for Modify the Report that is Generated.
    Also you can also change the report sequence 'reportgen_txt.seq' to achieve the desired affect. If you go for modifying the report sequence then copy this to the User folder and then make your changes.
    In the Resources Library you can find simple examples were the report has been modified by either using the Override Callbacks or by modifying the actual sequence.
    One other item in the Report Options you will have to set the 'Select a Report Generator for Producing the Report Body' control to use the Sequence instead of the DLL.
    Hope this helps
    Ray Farmer
    Regards
    Ray Farmer

  • How to display the results in order by based on search value

    Hi All,
    how to display the results in the below order.
    CREATE TABLE TEST( SONGID  NUMBER, TITLE   VARCHAR2(200))
    INSERT INTO TEST(SONGID,TITLE) VALUES (10,'AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (11,'CICCONE, MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (12,'DALLIN, MADONNA LOUISE/STOCK');
    INSERT INTO TEST(SONGID,TITLE) VALUES (13,'MADONNA');
    INSERT INTO TEST(SONGID,TITLE) VALUES (14,'MADONNA (A)/ AHMADZAI, MIRWAIS (C)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (15,'MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (16,'MIRWAIS AHMADZAI, MADONNA');     
    INSERT INTO TEST(SONGID,TITLE) VALUES (17,'MIRWAIS (CA)/ MADONNA (CA),AHMADZAI');
    INSERT INTO TEST(SONGID,TITLE) VALUES (18,'MADONNA (CA),CICCONE');
    SELECT *FROM  TEST WHERE INSTR (TITLE, 'MADONNA') > 0
    output:
    SONGID     TITLE
    10     AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
    11     CICCONE, MADONNA (CA)
    12     DALLIN, MADONNA LOUISE/STOCK
    13     MADONNA
    14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
    15     MADONNA (CA)
    16     MIRWAIS AHMADZAI, MADONNA
    17     MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
    18     MADONNA (CA),CICCONE
    Expected output :
    13     MADONNA
    14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
    15     MADONNA (CA)
    18     MADONNA (CA),CICCONE
    ...if user searches with 'MADONNA' , I have to display the results like title starts with 'MADONNA' first then rest of the records.
    Please let me know is it possible to display the results in that order.
    Regards,
    Rajasekhar

    This may be a bit more accurate:
    SQL> SELECT *
      2  FROM   TEST
      3  WHERE  INSTR (TITLE, 'MADONNA') > 0
      4  ORDER  BY INSTR (TITLE, 'MADONNA')
      5           ,TITLE
      6  ;
                  SONGID TITLE
                      13 MADONNA
                      14 MADONNA (A)/ AHMADZAI, MIRWAIS (C)
                      15 MADONNA (CA)
                      18 MADONNA (CA),CICCONE
                      12 DALLIN, MADONNA LOUISE/STOCK
                      11 CICCONE, MADONNA (CA)
                      17 MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
                      16 MIRWAIS AHMADZAI, MADONNA
                      10 AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)

  • KE5Z - Actual Line Item report freezes before displaying the result

    Hi,
    We have a situation. We have a Z report in Finance. We have linked KE5Z to this Z report using the Report Painter along with 15 others. When we run the Z report it works fine and displays result. In the displayed result, if we futher drill down for the actual line items for a particular profit center, system freezes. It does not display any result even after a long wait.
    We did our analysis and found that the program takes the profit center number range from the least available in the profit center group to highest available in the profit center group and starts checking for every line item in it. This happens when the profit center group has more than 50 profit centers in them. When we run KE5Z tcode individually, it runs fine.
    We are not sure how to go about finding a way out of it.
    Has anyone faced such issue? Do you know of any OSS note that can help us? or If anyone of you can think of a solution or a way to go about it?
    Your help on this is much appriciated.
    Regards,
    Mukund S

    Hi,
    Any pointers to this will be appriciated...
    Regards,
    Mukund S

  • Altavista will not display search results

    altavista us will not display search results. altavista canada works fine. On us site results will display in no style page but not in basic page style. The page comes up blank. This may have been caused by delta search. I think I have rid my computer of delta? Reloaded firefox. I use norton 360 and have run registry clean up and virus scans. Also cleaned explorer. In explorer the u.s. altavista works ok that is why I think it something to do with firefox and delta search showed up at the same time unwanted and forced a change on my home page. Have cleared computer of what delta files I could find my have something in the registry but I would not know what to look for or to do with. I am running xp

    In a round about way you solved my problem cor-el ! At the end of standard diagnostic there was mention of malware so I ran malwarebytes before running profile manager. malwarebytes found 21 items some in the registry. deleted these items and tried altavista us again and to my surprise it is working ok now.I thought norton 360 would catch such things but I guess it doesn't ! will keep and run a malware program from now on. thank you for your help.

  • Search button not displaying search results

    I have created a page where you enter a string and click a search button and it will display the file that contains that string. It works on one page but not any of the other pages I have created. I went to dkubiceck page and copied the code for the search button there.
    This is the code I used to run the query to bring up the document information:
    select score(1) relevance, filename,transcript_id,
    dbms_lob.getlength("trans_document") "trans_document"
    from transcript_documents
    where contains (trans_document, :P20_SEARCH, 1) > 0
    order by 1 desc
    I can run the script in sql workshop and it returns information but I can't get the page to display anything so I think it has something to do with the search button. Does it have something to do with the button request. I have the request as go which is what the Oracle Text for APEX tutorial indicates. I am at a loss as to why it is working in one place and not in another. HELP!!!!!!!

    I used the Using Oracle Application Express to Build
    Oracle Text Web Applications An Oracle White Paper documentation to create this button. The instructions to create the button is below.
    http://www.oracle.com/technology/products/database/application_express/pdf/apex_text_application_v1.6.pdf
    To create a button to submit the search:
    1. Under Buttons, click the create icon ().
    2. For Region, select Search Terms(s).
    3. For Task, select Create a button displayed among this region’s items.
    4. For Button Name, enter P1_FIND.
    5. For Label, enter Find.
    6. For Button Style, select HTML Button.
    Run your page using the run page icon () and your development username and password. Your page should look similar to the following figure.
    This was the instructions to create the query region:
    To create a query region:
    1. Navigate back to the Page Definition for the Search page. You can do this by using the edit links at the bottom of the running page, Edit Page 1.
    2. Under Regions, click the create icon ().
    3. For Region Type, select Report.
    4. For Report Implementation, select SQL Report.
    5. For Title, enter Results.
    Using Oracle Application Express to Build Oracle Text Web Applications Page 9
    6. Enter the following SQL query:
    select score(1) relevance, doc_title, doc_url
    from htmldb_documentation
    where CONTAINS (doc_url, :P1_SEARCH, 1) > 0
    order by 1 desc
    7. For Display Conditions, for Condition Type, select Value of Item in Expression 1 is NOT NULL.
    8. For Expression 1, enter P1_SEARCH.
    This condition specifies to only display the Results region if a term is entered as a search criterion.
    Run the page and enter a search criterion for Term(s). Your results should look similar to the following figure.
    Figure 2.0
    The only thing I added to the query above is a dbms_doc.getlength statement to be able to open a link to the document.
    The first 2 times I created this on a page it worked just fine. But now no matter what conputer or schema or application I create this button in it won't display the results. I can admit that I have no experience creating a button with a different request than what comes up in the wizard. And the documentation that I found on creating buttons was of no help.
    I have not made any changes to anything in the wizard so can someone guide me as to how to create a button that will allow me to search a document using Oracle Text as described above

  • Duck Duck go Browser doesn't display search results, how to fix it?

    The same search using other browsers displays the results. But i want to use Duck Duck Go

    Did you already try safe mode or clear the recent history?
    *[http://mzl.la/MwuO4X Firefox in safe mode]
    *[http://mzl.la/NZyoI8 Clear recent history]
    Also try reset Firefox
    *[http://mzl.la/MnSTZB Reset Firefox]

  • I want a stamp to write to the file metadata and be able to display the result in windows explorer.

    I want a stamp to write to the file metadata and be able to display the result in windows explorer. I have read PDF Stamp Secrets and can write to Custom Metadata but don't know how to display that custom field in explorer. Can I have the stamp write to a standard (non-custom) metadata field? Or, how do it get the custom field to display in explorer? Windows is pretty stingy with the file details it displays for PDF files, in fact there are no editable fields provided (like are available for Office files).   I want this to work for multiple users hopefully without having to get the IT group involved to make (or allow) system modifications to make this work. Any ideas? Thank you.

    Metadata for Windows Explorer is tagged with different names than the metadata for PDFs. Acrobat cannot copy the metadata to the tagged items of the file header.
    There are tools like EXIFTool that can manipulate the data as necessary. Phil Harvey also provides the details about the file types and their metadata tags and values so you should be able to map the tags that need to be updated.

  • Displaying file results in combo box

    i have read a list of numbers from a file by using vector, and the results are displayed. However i wish to somehow display the results in a jcombo box or equivalent in the main super class, please help, thanks.

    BufferedReader in = new BufferedReader(new FileReader("id.doc"));
             while (true) {
                  String File = in.readLine();
              if (File == null)
                      break;
                     StringTokenizer parser = new StringTokenizer(File, " ");
               nxtname = parser.nextToken();
               System.out.println(nextt);This reads my id's from file, however I want to display the results into a jcombo box in my main super class, what would the code be to do this?
    Thanks

  • So I have been using my iPad for a few months now and I recently noticed that the time display next to the playlist name in the music  app that is supposed to display the total song count and time of a playlist is way off. I have a 25 song playlist that 2

    So I have been using my iPad for a few months now and I recently noticed that the time display next to the playlist name in the music  app that is supposed to display the total song count and time of a playlist is way off. I have a 25 song playlist that is around 2 hours on my computer appears as 2003 minutes on my iPad.  It's a smart playlist limited to 25 songs if that makes any difference. Is this happening to anyone else? Any help would be appreciated!

    Greetings,
    First make an iCal backup, File > Export > Archive.
    Remove the following to the trash and restart your computer:
    Home > Library > Caches
    Home > Library > Calendars > Calendar Cache, Cache, Cache 1, 2, 3, etc. (Do not remove Sync Cache or Theme Cache)
    Home > Library > Preferences > com.apple.ical (There may be more than one of these. Remove them all.)
    __NOTE: Removing these files will remove any shared (CalDAV) calendars you may have access to. You will have to re-add those calendars to iCal > Preferences > Accounts.
    Once the computer is back up and running open iCal and test.
    Hope that helps.

Maybe you are looking for