The ResultSet.next() returns false....

Hai,
I am working on jdbc. The connection credentials all correct, and its getting connected to the sybase without any problems. But I am not able to perform any 'select' or "update" statements...There are no exception or any errors...But the ResultSet.next() returns false and executeUpdate returns 0 . .
I think you can help me.....Thanks...

Yes the query is sameAs already pointed out, there are ONLY two possibilities.
1. The query is not the same
2. The database is not the same.
You are making assumptions about what is going on and then drawing conclusions.
You need to understand that you assumptions are wrong. So it doesn't matter what conclusion you draw.
In terms of why the query isn't the same there could be any number of reasons but usually it is because you are passing in data and that data isn't what you think (assume) it is. It can also be that you are constructing the SQL and that construction is different. It could be that the environment that you use to test as settings which impact SQL.

Similar Messages

  • Bug Report: ResultSet.isLast() returns false when queries return zero rows

    When calling the method isLast() on a resultset that contains zero (0) rows, false is returned. If a resultset contains no rows, isLast() should return true because returning false would indicate that there are more rows to be retrieved.
    Try the following Java source:
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    public class Test2 {
    public static void main (String [] args) throws Exception {
    Connection conn = null;
    String jdbcURL = "jdbc:oracle:thin:@" +
    "(DESCRIPTION=(ADDRESS=(HOST=<host computer>)"+
    "(PROTOCOL=tcp)(PORT=<DB port number>))"+
    "(CONNECT_DATA=(SID=<Oracle DB instance>)))";
    String userId = "userid";
    String password = "password";
    try{
    // Load the Oracle JDBC Driver and register it.
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // *** The following statement creates a database connection object
    // using the DriverManager.getConnection method. The first parameter is
    // the database URL which is constructed based on the connection parameters
    // specified in ConnectionParams.java.
    // The URL syntax is as follows:
    // "jdbc:oracle:<driver>:@<db connection string>"
    // <driver>, can be 'thin' or 'oci8'
    // <db connect string>, is a Net8 name-value, denoting the TNSNAMES entry
    conn = DriverManager.getConnection(jdbcURL, userId, password);
    } catch(SQLException ex){ //Trap SQL errors
    // catch error
    //conn = new OracleDriver().defaultConnection(); // Connect to Oracle 8i (8.1.7), use Oracle thin client.
    PreparedStatement ps = conn.prepareStatement("select 'a' from dual where ? = ?", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // Use any query that will return zero rows.
    ps.setInt(1, 1); // Set the params so that the query returns 0 rows.
    ps.setInt(2, 2);
    ResultSet rs = ps.executeQuery();
    System.out.println("1. Last here? " + rs.isLast());
    while (rs.next()) {
    // do whatever
    System.out.println("2. Last here? " + rs.isLast());
    ps.close();
    rs.close();
    EXPECTED RESULT -
    1. Last here? true
    2. Last here? true
    ACTUAL RESULT -
    1. Last here? false
    2. Last here? false
    This happens to me on Oracle 9.2.0.1.0.

    387561,
    For your information, I discovered this problem from
    running a query that did access an actual DB table.
    Try it and let me know.I did say I was only guessing, and yes, I did try it (after I posted my reply, and before I read yours). And I did check the query plan for the queries I tried -- to verify that they were actually doing some database "gets".
    In any case, the usual way that I determine whether a "ResultSet" is empty is when the very first invocation of method "next()" returns 'false'. Is that not sufficient for you?
    Good Luck,
    Avi.

  • Resultset next() return true even there's not record

    Here's the code:
    public Object getColumn(String s) throws SQLException {
    Object o = null;
    ResultSet r = db.select(s); // a db rpocess return a resulset
    int Columns = r.getMetaData().getColumnCount();
    if (Columns == 1) {
    Vector v = new Vector();
    while (r.next()) {
    v.add(r.getString(1));
    o = v;
    } else if (Columns == 2) {
    Hashtable h = new Hashtable();
    while (r.next()) { // <----problem in this line =============
    h.put(r.getString(1), ( (r.getString(2) == null) ? "" : r.getString(2)));
    o = h;
    return o;
    j2se 1.4.1 (with the Jbuilder8) and hsqldb 1.7.1
    actually, it works if we got records in the resultset, but the next() is true even there's not record returned.

    Nothing to do with your problem but this line could cause other problems
    h.put(r.getString(1), ( (r.getString(2) == null) ? "" : r.getString(2)));You are retrieving the same column twice. Some JDBC drivers throw an exception if you try doing this.

  • The mkdir() function in java returning false. Why?

    I am trying to create the folder archive under the following directory structure:
    E:/preweb/CATest/DL/Zipra Internal/EventCompletion/html/archive/
    using the boolean mkdir() function in java.
    Though the folder archive does not exist under html folder, still the function is returning false.
    Canm someone let me know why?

    And you have checked that by using
    File file =// E:/preweb/CATest/DL/Zipra Internal/EventCompletion/html/archive/
    Sys.out.println( file.getParentFile().exists() );

  • Resultset.next() Issue

    Okay I have narrow my issue down to activity involved with the resultset.next() method. What is happening is I am working through a small resultset--3 records. These records are made up of columns from 3 seaprate tables (9 total). Some of these tables have many records (> 3K) in them. I moved the SQL statement in a store procedure so we can execute the query in a faster manner. The store procedure is returning the information in only 46ms. However, when I start looking through the resultset on the app server, it is taking 19K ms for the first time through the loop.
    I am at a lost to explain why the first iteration is taking so long. I have looked back at the SQL statement. I use alias names for the tables. I identify the column names in the select statement, but I do not use aliases for the column names. I am wondering if my problem is connected to the fact that the Oracle Driver
    maybe going back to get the column names the first time through the result set. I am not using the column name to index into the resultset. If my theory is right, this would explain the high latency. If I am wrong, I am stumped.
    Any suggestions or help explaining this would be greatly appreciated.
    As always, thanks for reading my post.
    Russ

    Execution of a CallableStatement (Procedure) is relatively fast. Getting ResultSet back is fast. But First iteration over the result set takes a lot of time comparing to the following iterations.
    Part of the code :
    long start=System.currentTimeMillis();
    int i=0;
    long local=System.currentTimeMillis();
    while(rs.next()){
    if (i==0){
    MetricsUtil.printTime("ResultSetRowHolder.getRows(ResultSet rs) ["+list.size()+" ]",local);
    local=System.currentTimeMillis();
    hol=new ResultSetRowHolder(rs);
    list.add(hol);
    i++;
    if (i%100==0){
    MetricsUtil.printTime("ResultSetRowHolder.getRows(ResultSet rs) ["+list.size()+" ]",local);
    local=System.currentTimeMillis();
    MetricsUtil.printTime("ResultSetRowHolder.getRows(ResultSet rs) ["+list.size()+" ]",start);
    Printouts
    Metrics << QueryHelper.executeStatement() >> Total time -> 2.836 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [0 ] >> Total time -> 13.867 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [100 ] >> Total time -> 0.48 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [200 ] >> Total time -> 0.44 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [300 ] >> Total time -> 0.47 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [400 ] >> Total time -> 0.38 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [500 ] >> Total time -> 0.37 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [600 ] >> Total time -> 0.38 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [700 ] >> Total time -> 0.35 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [800 ] >> Total time -> 0.34 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [900 ] >> Total time -> 0.32 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [1000 ] >> Total time -> 0.34 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [1100 ] >> Total time -> 0.41 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [1200 ] >> Total time -> 0.32 sec
    Metrics << ResultSetRowHolder.getRows(ResultSet rs) [1230 ] >> Total time -> 14.340 sec

  • How do I find a word in all my document, return false if it's not in there.

    Hi,
    I struggle with something that should be easy, and didn't find any answer on this forum.
    I have a list of word that I want to search in a 300 pages catalogue in InDesign. I'd like to know how can i:
    1) Look for the word
    2) Return true if it's in the document
    3) Return false if it's not
    FYI, the words i'm searching are product code, so if they're not in the catalogue, the product isn't in the catalogue.
    Thanks a lot,
    Olivier

    Hi Oliver,
    Use this,
    var doc = app.documents;
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.findWhat = "Text";
    var foundtext = app.activeDocument.stories.everyItem().paragraphs.everyItem().findText();
    for (var i=0;i<foundtext.length;i++){
            if (foundtext[i].length != 0){
                alert("True");
            else{
                alert("False")
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;

  • JDBC ResultSet.next() Error

    Can anyone help me with this error? I am running this in AIX box (java 1.3) using OCI to VMS RDB Server. I get this error when looping through the ResultSet.next().
    Thanks
    --Elie
    Exception in thread "main" java.sql.SQLException: ORA-09100: Message 9100 not found; No message file for product=NATCONN, facility=GTW
    %SYSTEM-F-NOMSG, Message number 0000C1C4
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java(Compiled Code))
    at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java(Compiled Code))
    at oracle.jdbc.oci8.OCIDBAccess.fetch(OCIDBAccess.java(Compiled Code))
    at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java(Compiled Code))
    at mbr.main(mbr.java(Compiled Code))

    I got it resolved by using NVL function on each of my DATE columns. I found a log from the RDB server complaining about dates. The NVL seems did the trick.
    Thanks again for your reply.
    --Elie                                                                                                                                                                                                                                                                                                                                                                                                           

  • Limit the Resultset fetch for query executed

    We have few reports on our dashboard that return huge amount of data. The query takes a lot of time to return the data.
    We wanted to check if there is a way we could control the resultset being returned during the query execution. For example - if our report query returns about 10,000 rows of data but in our report we are initially showing only 1000 and giving user the pagination feature to view the data. Can we control the first time data fetch for the SQL. We want the SQL to fetch only 1000 rows first so that it returns the resultset soon. After clicking on the pagination then the entire resultset can be returned.
    We found a variable - VIRTUAL_TABLE__PAGE_SIZE in the NQSCOnfig.INI file. Is this something we need to use or does OBIEE offer any other option?
    Please suggest
    Thanks.

    You can also create an Oracle profile with limited resources and assign it to the Oracle account running the queries (this profile will be used for all queries run by the corresponding user). Resources can only specifed in cpu time (not elapsed time) or logical reads.
    See http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96521/users.htm#15451
    and http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_611a.htm#2065932

  • Can someone else try to compile this and see why the program is returning..

    Can someone else try to compile this and see why the program is returning "false" when I try to delete the files on exit (at bottom of code)... I have the source code uploaded to the web as well as my 2 text test files inside a zip file(they need to be unzipped so you can try to test the program) and .class file... the program works the way i want it to, but i just can't seem to delete the 3 temporary files i use... why??? why does it return false???
    Thanks in advance,
    Disco Hristo
    http://www.holytrinity-holycross.org/DiscoHristo/Assemble.java
    http://www.holytrinity-holycross.org/DiscoHristo/Assemble.class
    http://www.holytrinity-holycross.org/DiscoHristo/tests.zip
    * Assemble.java 1.0 02/06/22
    * @author Disco Hristo
    * @version 1.0
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class Assemble
         public static void main(String args[]) throws IOException
              if (args.length > 0) //     Checks to see if there are any arguments
                   printArgumentInfo ();
              else // if no arguments run the program
                   getInput ();
                   printToFile ();
                   deleteFiles ();
         public static void getInput () throws IOException
         //     Gets the input and then send it to 3 files according to Tags
              File head = new File ("head.chris");
    PrintStream headStream = new PrintStream (new FileOutputStream (head));
    File body = new File ("body.chris");
    PrintStream bodyStream = new PrintStream (new FileOutputStream (body));
    File foot = new File ("foot.chris");
    PrintStream footStream = new PrintStream (new FileOutputStream (foot));
    String input; //     String used to store input                
    File d = new File(".");
    String files[] = d.list();
    for (int n=0; n!=files.length; n++)
         if (files[n].endsWith(".txt") == true)
              String fileName = files[n];
              BufferedReader in = new BufferedReader (new FileReader(fileName));
                   while (true)
                   input = in.readLine();
                   if (input != null)
                        input = input.trim();
                        if (input == null) // if no more input                          
                             break;
                        else if ( (input.compareTo("<HEAD>")) == 0) // if start of <HEAD> text
                             do
                                  input = in.readLine();
                                       if (input != null)
                                       input = input.trim();
                                       if ( ((input.compareTo("<BODY>")) == 0) ||
                                                      ((input.compareTo("<FOOT>")) == 0) ||
                                                      ((input.compareTo("</BODY>")) == 0) ||
                                                      ((input.compareTo("</FOOT>")) == 0) ||
                                                      ((input.compareTo("<HEAD>")) == 0))
                                                      //checks to see if tags in input are in correct order
                                            System.out.println("Input Is Incorrectly Formatted - Tag Error");
                                            System.out.println("Close your <HEAD> tag before starting another tag.");
                                            System.exit(1); //exit program without printing data                                                   
                                       if ( (input.compareTo("</HEAD>")) != 0) //if not end of tag
                                            headStream.println(input); //print to text file
                             while ( (input.compareTo("</HEAD>")) != 0);
                        else if ( (input.compareTo("<BODY>")) == 0) // if start of <BODY> text
                             do
                                  input = in.readLine();
                                  if (input != null)
                                       input = input.trim();
                                       if ( ((input.compareTo("<HEAD>")) == 0) ||
                                                      ((input.compareTo("<FOOT>")) == 0) ||
                                                      ((input.compareTo("</HEAD>")) == 0) ||
                                                      ((input.compareTo("</FOOT>")) == 0) ||
                                                      ((input.compareTo("<BODY>")) == 0))
                                                      //checks to see if tags in input are in correct order
                                            System.out.println("Input Is Incorrectly Formatted - Tag Error");
                                            System.out.println("Close your <BODY> tag before starting another tag.");
                                            System.exit(1); //exit program without printing data                                                   
                                       if ( (input.compareTo("</BODY>")) != 0) //if not end of tag
                                            bodyStream.println(input); //print to text file
                             while ( (input.compareTo("</BODY>")) != 0);
                             else if ( (input.compareTo("<FOOT>")) == 0) // if start of <FOOT> text
                                  do
                                  input = in.readLine();
                                  if (input != null)
                                       input = input.trim();
                                       if ( ((input.compareTo("<BODY>")) == 0) ||
                                            ((input.compareTo("<HEAD>")) == 0) ||
                                                 ((input.compareTo("</BODY>")) == 0) ||
                                                 ((input.compareTo("</HEAD>")) == 0) ||
                                                 ((input.compareTo("<FOOT>")) == 0))
                                                 //checks to see if tags in input are in correct order
                                            System.out.println("Input Is Incorrectly Formatted - Tag Error");
                                            System.out.println("Close your <FOOT> tag before starting another tag.");
                                            System.exit(1); //exit program without printing data                                                   
                                       if ( (input.compareTo("</FOOT>")) != 0) //if not end of tag
                                                 footStream.println(input); //print to text file
                             while ( (input.compareTo("</FOOT>")) != 0);
                   else
                        break;
    public static void printToFile () throws IOException
    // Prints the text from head.txt, body.txt, and foot.txt to the output.log
         File head = new File ("head.chris");
         FileReader headReader = new FileReader(head);
              BufferedReader inHead = new BufferedReader(headReader);
              File body = new File ("body.chris");
              FileReader bodyReader = new FileReader(body);
              BufferedReader inBody = new BufferedReader(bodyReader);
              File foot = new File ("foot.chris");
              FileReader footReader = new FileReader(foot);
              BufferedReader inFoot = new BufferedReader(footReader);
              PrintStream outputStream = new PrintStream (new FileOutputStream (new File("output.log")));
              String output;     //string used to store output
              while (true)
                   output = inHead.readLine();
                   if (output == null) //if no more text to get from file
                   break;
                   else
                        outputStream.println(output); // print to output.log
              while (true)
                   output = inBody.readLine();
                   if (output == null)// if no more text to get from file
                   break;
                   else
                        outputStream.println(output); // print to output.log
              while (true)
                   output = inFoot.readLine();
                   if (output == null) //if no more text to get from file
                   break;
                   else
                        outputStream.println(output); // print to output.log
              //Close up the files
              inHead.close ();
              inBody.close ();
              inFoot.close ();
              outputStream.close ();     
         public static void printArgumentInfo () //     Prints argument info to screen
              System.out.println("");
              System.out.println("Disco Hristo");
              System.out.println("");
              System.out.println("Assemble.class is a small program that");
              System.out.println("takes in as input a body of text and then");
              System.out.println("outputs the text in an order according to");
              System.out.println("the tags that are placed in the input.");
         public static void deleteFiles ()
              File deleteHead = new File ("head.chris");
              File deleteBody = new File ("body.chris");
              File deleteFoot = new File ("foot.chris");
              deleteHead.deleteOnExit();
              deleteBody.deleteOnExit();
              deleteFoot.deleteOnExit();
    }

    I tired your program, it still gives false for files deleted. I tool the same functions you used in your program and ran it. The files get deleted. Tried this :
    <pre>
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class FileTest {
         public static void main(String args[]) {
              FileTest f = new FileTest();
              try {
                   f.createFile();
                   f.deleteFile();
              } catch(IOException ioe){
                   System.out.println(ioe.getMessage());
         public void createFile() throws IOException {
              System.out.println("In create file method...");
              File test = new File("test1.txt");
              File tst = new File("text2.txt");
              PrintStream testStream = new PrintStream (new FileOutputStream (test));
              PrintStream tstStream = new PrintStream (new FileOutputStream (tst));
              testStream.println("this is a test to delete a file");
              tstStream.println("this is the second file created");
              testStream.close();
              tstStream.close();          
         public void deleteFile() throws IOException {
              File test = new File("test1.txt");
              File tst = new File("text2.txt");
              System.out.println(test.delete());
              System.out.println(tst.delete());
    </pre>
    Also check the starting and closing braces for your if..else blocks.
    -Siva

  • Number of rows returned by the resultset is wrong

    Hi All,
    I have pasted the code i used for JDBC. The problem is the number of rows returned by the resultset is 5 times that of the original data. Is something wrong with my code. Can anyone pls point out the mistake I have done if any.
        public ArrayList dataBreakup(String team, int monthNo, int year) {         String sqlDataBreakup = "";         Connection con1 = null;         Statement stmt = null;         ResultSet rs = null;         ArrayList data = new ArrayList();         int noRows = 0;         Calendar cal = Calendar.getInstance();         Calendar cal2 = new GregorianCalendar(cal.get(Calendar.YEAR), monthNo, 1);         int days = cal2.getActualMaximum(cal2.DAY_OF_MONTH);         String start_date = "01-Jan-" + year;         String end_date = days + "-" + monthName[cal2.get(Calendar.MONTH)] + "-" + cal2.get(cal2.YEAR);         System.out.println("START: " + start_date);         System.out.println("END: " + end_date);         databaseConnection dbObject = new databaseConnection();         try {             con1 = dbObject.GetConnection();             stmt = con1.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);             sqlDataBreakup = "Select * from EXPENSE_STORE WHERE " +                     "team='" + team + "'AND category != 'Pending PO''s' AND ACCOUNTING_DATE " +                     "BETWEEN to_date('" + start_date + "') AND to_date('" + end_date + "')";             rs = stmt.executeQuery(sqlDataBreakup);                         ResultSetMetaData rsmd = rs.getMetaData();             int numColumns = rsmd.getColumnCount();             data.add(numColumns);             for (int i = 1; i < numColumns + 1; i++) {                 data.add(rsmd.getColumnName(i));             }                        while (rs.next()) {                                noRows++;                 for (int i = 1; i < numColumns + 1; i++) {                     switch (rsmd.getColumnType(i)) {                         case java.sql.Types.NUMERIC:                             data.add(rs.getFloat(i));                             break;                         case java.sql.Types.DATE:                             data.add(rs.getDate(i));                             break;                         default:                             data.add(rs.getString(i));                             break;                     }                                    }                     }             data.add(1, noRows);             rs.close();         } catch (SQLException SQLe) {             System.out.println("DumpData() : SQL Exception" + SQLe.getMessage());             SQLe.printStackTrace();         } catch (Exception e) {             System.out.println("DumpData() : Other Exception");             e.printStackTrace();         } finally {             dbObject.CloseConnection(con1);         }         return data;     }
    Thanks
    Cheers N...

    Only thing i can say is
    try the following
    replace your function by this one and tell us the console output of the same
    public ArrayList dataBreakup(String team, int monthNo, int year) {
            String sqlDataBreakup = "";
            Connection con = null;          
            ArrayList data = new ArrayList();
            int noRows = 0;
            Calendar cal = Calendar.getInstance();
            Calendar cal2 = new GregorianCalendar(cal.get(Calendar.YEAR), monthNo, 1);
            int days = cal2.getActualMaximum(cal2.DAY_OF_MONTH);
            String start_date = "01-Jan-" + year;
            String end_date = days + "-" + monthName[cal2.get(Calendar.MONTH)] + "-" + cal2.get(cal2.YEAR);
            System.out.println("START: " + start_date);
            System.out.println("END: " + end_date);
            System.out.println("START: " + start_date);
            System.out.println("END: " + end_date);
            databaseConnection dbObject = new databaseConnection();
            try {
                con = dbObject.GetConnection();          
                sqlDataBreakup = "Select * from EXPENSE_STORE WHERE " +
                        "team = '"+team+"' AND category != 'Pending PO''s' AND ACCOUNTING_DATE " +
                        "BETWEEN to_date('"+start_date+"') AND to_date('"+end_date+"')";
                   System.out.println("-----------sql starts---------------");
                   System.out.println(sqlDataBreakup);
                   System.out.println("-----------sql ends---------------");
                PreparedStatement pstmt = con.prepareStatement(sqlDataBreakup);
                   pstmt.setString(1, team);
                pstmt.setString(2, start_date);
                pstmt.setString(3, end_date);
                ResultSet rs = pstmt.executeQuery();
                ResultSetMetaData rsmd = rs.getMetaData();
                int numColumns = rsmd.getColumnCount();
                data.add(numColumns);
                for (int i = 1; i < numColumns + 1; i++) {
                    data.add(rsmd.getColumnName(i));
                while (rs.next()) {
                    noRows++;
                    for (int i = 1; i < numColumns + 1; i++) {
                        switch (rsmd.getColumnType(i)) {
                            case java.sql.Types.NUMERIC:
                                data.add(rs.getFloat(i));
                                break;
                            case java.sql.Types.DATE:
                                data.add(rs.getDate(i));
                                break;
                            default:
                                data.add(rs.getString(i));
                                break;
                //data.add(1, noRows);
                   System.out.println("no of Rows : " +noRows );
            } catch (SQLException SQLe) {
                System.out.println("DumpData() : SQL Exception" + SQLe.getMessage());
                SQLe.printStackTrace();
            } catch (Exception e) {
                System.out.println("DumpData() : Other Exception");
                e.printStackTrace();
            } finally {
                dbObject.CloseConnection(con);
            return data;
        }and try running the sql printed on the screen in your db and then let us know the result.
    in this code i have removed some of your code in order to simplify the problem.

  • How do I combine logical functions so Numbers will complete the entire operation and not stop as soon as it returns false?

    I'm trying to use the following formula, in which column A references a drop-down menu, and $K$13 is one of three different options possible for column A. The formula works if all the drop-down selections are the same, but as soon as one cell doesn't equal $K$13, the operation stops and none of the following cells are checked. I want all the cells to be checked so the destination cell will display any text from column R where column A = $K$13.
    =IF(A4=$K$13,IF(J4,CONCATENATE(R4," | ",),"")&IF(A5=$K$13,IF(J5,CONCATENATE(R5," | ",),"")&IF(A6=$K$13,IF(J6,CONCATENATE(R6," | ",),"")&IF(A7=$K$13,IF(J7,CONCATENATE(R7," | ",),"")&IF(A8=$K$13,IF(J8,CONCATENATE(R8," | ",),"")&IF(A9=$K$13,IF(J9,CONCATENATE(R9," | ",),"")&IF(A10=$K$13,IF(J10,CONCATENATE(R10," | ",),""),""),""),""),""),""),""),"")
    Can anyone help me? Thanks!

    You've set it up as a series of nested IF statements, rather than a series of independent IF statements. Here's a diagram of a similar three part formula:
    IF(test1,"T1"&IF(test2,"T2"&IF(test3,"T3",false3),false2),false1)
    IF test1 is FALSE, control passes directly to false1 and the program exits the formula, returning (in your case) a null string.
    IF test 1 is TRUE, then "T1"  is passed on to the next IF..
    IF test2 is FALSE, control passes directly to false2 (which in your case appends a null string) and the program exits the formula, returning "T1"
    IF test 2 is TRUE, then "T2" is appended to "T1", making the value now "T1T2" and that is passed on to the next IF.
    etc.
    You need to rewrite your formula so that it consists of a set of independent IF statements, each returning the text from the corresponding cell in column R and the three character string " | " if its test is TRUE, or a null string ( "" ) if its test is FALSE.
    The individual formulas can be placed in a concatenation string in a single cell (as you've attempted), but that makes for difficult reading and editing.
    Each of the IF statements is identical except for the cells whose value is being checked (A4 and J4 in the first) and the cell from which the 'if-true' value will be retrieved (R4 in the first). Because of this, my own choice would be to write the formula a single time, fill it down a column into rows 4 to 10, then use a simple concatenation formula to string those results together into a single cell.
    =IF(A4=$K$13,IF(J4,CONCATENATE(R4," | "),""),"")
    Assuming R4 contains the text "ABC", the formula will return:
    a null string if A4 contains a different value from K13.
    a null string if A4 contains the same value as K13 but J4 is empty. contains the number zero, or contains the Boolean value FALSE
    an error triangle if A4 contains the same value as K13 but J4 contains a value that is text (or formatted as text), a Duration, or a Date and Time value.
    the text string "ABC | " if A4 contains the same value as K13 and J4 contains a number that is not zero, or contains the Boolean value TRUE.
    Because the individual formulas will reference cells in their own row, the row part of those cell references may be removed.
    =IF(A=$K$13,IF(J,CONCATENATE(R," | "),""),"")
    Place the formula into row 4 of an available column (I'll assume Z for purposes of the second formula), then fill it down from Z4 to Z10.
    Then place this formula in the cell where you want to see the results:
    =Z4&Z5&Z6&Z7&Z8&Z9&Z10
    Regards,
    Barry

  • How to get both, the ResultSet and Output (return value) from Oracle Stored Procedure

    Hi! I am doing a conversion from MSSQL to Oracle with C++ and MFC ODBC. Any comment is appreciated!! I have Oracle 8i and Oracle ODBC 8.1.6 installed.
    My question is how to retrieve the return value AND ALSO the resultSet at the same time by using Oracle function without modifying my souce codes (except puttting mypackage. string infron of my procedure name, see below).
    -- My source code in C++ with MSSQL ....
    sqlStr.Format("{? = call ListOfCustomers(%i)}", nNameID);
    RcOpen = CustomerList.Open(CRecordset::forwardOnly, sqlStr, CRecordset::readOnly );
    Where CustoemrList is a Crecordset object...
    IN DoFieldExchange(CFieldExchange* pFX) I have ...
    //{{AFX_FIELD_MAP(CQOSDB_Group)
    pFX->SetFieldType(CFieldExchange::outputColumn);
    RFX_Long(pFX, T("Name"), mCustoemrName);
    //}}AFX_FIELD_MAP
    // output parameter
    pFX->SetFieldType( CFieldExchange::outputParam );
    RFX_Int( pFX, T("IndexCount"), mCustomerNumber);
    -- m_CustomerNumber is where i store the return value!!!
    -- In Oracle Version, i have similar codes with ...
    sqlStr.Format("{? = call mypackage.ListOfCustomers(%i)}", nNameID);
    RcOpen = CustomerList.Open(CRecordset::forwardOnly, sqlStr, CRecordset::readOnly );
    -- I have oracle package/Body codes as following...
    create or replace package mypackage
    as
    type group_rct is ref cursor;
    Function listgroups(
    nameID NUMBER ,
    RC1 IN OUT Mypackage.group_rct ) return int;
    end;
    Create or replace package body mypackage
    as
    Function listgroups(
    NameID NUMBER ,
    RC1 IN OUT Mypackage.group_rct )return int
    IS
    BEGIN
    OPEN RC1 FOR SELECT Name
    from Customer
    WHERE ID = NameIDEND ListGroups;
    END
    return 7;
    END listgroups;
    END MyPackage;
    Ive simplified my codes a bit....
    null

    yes, it is exactly what i want to do and I am using Oracle ODBC driver.
    I tried using procedure with 1 OUT var fo numeric value and the other IN OUT ref cursor var instead of function, but error occurs when I called it from the application. It give me a memory ecxception error!!
    sqlStr.Format("{? = call ListOfCustomers(%i)}", nNameID);
    RcOpen = CustomerList.Open(CRecordset::forwardOnly, sqlStr, CRecordset::readOnly );
    it seems to me that the ? marker var is making all the trouble... can you please give me any more comment on this?? thanks!
    null

  • In a javascript function invoked from an onsubmit handler, if the function returns false, the form is still submitted. If I find an error in a form, how do I cancel the submit?

    HTML form has: action="/TTFFRP/addlicense.rex" method="get" onsubmit="validate_data();"
    validate_data is defined in tags:
    function validate_data()
    alert('in validate routine');
    if (document.getElementById('custname').value == '')
    alert('Customer name must not be blank; put in name of organization licensing File RePackager');
    return false;
    }

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
    [http://forums.mozillazine.org/viewforum.php?f=25]
    You'll need to register and login to be able to post in that forum.

  • (New to C# here) What is the best way to return false in a function if it cannot be executed successfully?

    In Javascript or PHP you can have a function that could return, for example, a string in case of success and false in case of failure.
    I've noticed (in the few days I've been learning C#) that you need to define a type of value that the function will return, so you need to return that type of value but in case of failure you can't return false.
    What is the best way to achieve this behavior and is there an example I can see?
    Thank you in advance,
    Juan

    Juan, be aware that returning null won't work with value types, such as an int, which can't be null. You'd have to use a nullable value type. A nullable int would be declared with a "?", such as:
    int? someOtherFunction(int param)
    if(something goes great)
    return param * 42;
    return null;
    And you have to use it like this:
    int? result = someOtherFunction(666);
    if (result != null) // you can also use result.HasValue
    // it worked, do something with the result
    // if you're doing math with the result, no problem
    int x = result * 2;
    // but if you're assigning it to another an int, you need to use this syntax
    int y = result.Value;
    Before nullable value types came along, for a method that returned an int, I'd use a value of something that wouldn't normally be returned by that method to indicate failure, such as a -1.
    ~~Bonnie DeWitt [C# MVP]
    That's something very very important to keep in mind. Can save you from a lot of headaches!
    So if you have an int function and it might return NULL, if you are doing Math with the return value you can use it directly, but if you're assigning it to another variable you have to use .Value?
    Thanks

  • When i close the window if press pressed next to the closure and returned again press not work

    When i close the window if press pressed next to the closure and returned again press not work

    Please expand upon your question with more detail. You can also post in your native language if English is a difficulty.

Maybe you are looking for

  • Adobe Acrobat X Pro Licences.

    Hello, Due to getting a new Desktop machine I am trying to install Adobe Acrobat X Pro onto the new machine. The current problem is that I don't have the license code anymore ( I still have Adobe Acrobat X Pro installed on my old machine). I tried to

  • SQL Server 2008 Analysis Services and OBI EE

    Hello, How to use the Multidimensional import functionality of the BI EE Administration against a cube stored in a SQL Server 2008 Analysis Services? Thanks, Paul

  • Applescript and Automator Issue

    Hi all, I'm trying to design an Automator and Applescript code that will perform the following. 1. Target specified application and make active 2. Hold down s key for 15 seconds 3. Hold down the left arrow key for 0.75 seconds 4. Hold down s key for

  • Is it possible to lock panels, to prevent accidental rearrangements?

    Hello, I pretty much live in SQL Developer and my biggest pet peeve with it is that I'll often be trying to click on a tab and instead of the tab gaining focus, it will think I wanted to drag it and separate that tab into its own panel. This happens

  • How CAn I Use a URL variable in Flex App

    Let say the link to a web page embedding a flex 2.0 app is http://www.myname.com?name=Bruce and I need to use the URL.name variable in the Flex app. How can I access URL parameters inside my Flex app? Bruce