Looping through OCIFetchStatement results

Hi, I'm having trouble looping through the results of OCIFetchStatement.
I have already connected to the database ok so I've excluded that code.
The code is as follows:
<?php
$sql = "SELECT dbname FROM live_rates_details";
$sql_statement = OCIParse($c, $sql) or die ("Couldn't parse statement.");
OCIExecute($sql_statement) or die ("Couldn't execute statement.");
// Fetch the results.
$numrows = OCIFetchStatement($sql_statement, $dbs);
// Print the number of rows
echo "$numrows<br>";
// Loop through the results
foreach ($dbs as $value)
echo "$value<br>";
?>
This code prints the number of rows correctly (22) but instead of looping through the array and printing results it just prints the word Array.
Any ideas?

Saju,
That worked perfectly. However I now only have one row in my database and two columns as below:
Column names are fruit and colour and the data row is Bananna and Yellow.
My problem is that when selecting the code as you've put it it returns the following BanannaYellow.
How can I seperate these? If I only want to access the yellow part, how do I do that? $value[$i][1]
Any help would be appreciated.

Similar Messages

  • Looping through 2 Result Sets - Not working-HELP!!

    This code loops through my first result set fine.....so I take the first part number from the result set, do a second result set to bring back all part conditions associated with that part number and compare them to see if they are all the same. When it hits the second loop with the second result set, it only loops once. I know this because of my system.out.println only print once.....can someone see where I'm going wrong....thanks in advance....
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    DataSource ds = this.getDataSource();
    HttpSession sess = req.getSession();
    if (sess == null)
    res.sendRedirect(/error.html");
    else
    synchronized(sess)
    UtilParts part = (UtilParts)sess.getValue("UtilParts.PARTS");
    String[] partNumbers = new String[10];
    for(int index=0; index < partNumbers.length; index ++)
    partNumbers[index] = req.getParameterValues("partNumber"+index)[0];
    partNumbers[index] = partNumbers[index].trim();
    String partDesc = req.getParameterValues("partdesc")[0].toUpperCase();
    partDesc = partDesc.trim();
    int rowsCounted = 0;
    for(int index = 0 ; index < partNumbers.length; index ++)
    if(partNumbers[index].equals(""))
    rowsCounted ++;
    Connection conn = null;
    ResultSet resultSet = null;
    ResultSet resultSetMultCond = null;
    PreparedStatement getPartInfo = null;
    Statement getMultPartCond = null;
    String sqlMultCond = null;
    String sql = null;
    try
    conn = ds.getConnection(id,pass);
    conn.setReadOnly(true);
    if(partDesc.equals(""))
    sql = "SELECT #PART,#PDESC,#CONDS,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PART LIKE '";
    boolean first = true;
    for (int i=0; i < partNumbers.length; i++)
    if (!partNumbers.equals(""))
    if (!first)
    sql += "%' OR #PART LIKE '";
    sql += partNumbers;
    first = false;
    sql += "%' AND #RECDT BETWEEN 20010816 AND 20020816 GROUP BY #PART,#PDESC,#CONDS ORDER BY #PART";
    getPartInfo=conn.prepareStatement(sql);
    resultSet = getPartInfo.executeQuery();
    if(!partDesc.equals(""))
    String sqlDesc = "SELECT #PART,#PDESC,#CONDS,COUNT(#PART) AS PCOUNT FROM MYLIB WHERE #PDESC LIKE ? AND #RECDT BETWEEN 20010816 AND 20020816 GROUP BY #PART,#PDESC ORDER BY #PART";
    getPartInfo = conn.prepareStatement(sqlDesc);
    getPartInfo.setString(1,partDesc + "%");
    resultSet = getPartInfo.executeQuery();
    Vector enum = new Vector();
    int rowsadded = 0;
    while (resultSet.next())
    rowsadded += 1;
    UtilParts utilityPart = new UtilParts();
    String s = (String)resultSet.getString("#PART");
    s = s.trim();
    utilityPart.setPartNumber(s);
    String t = (String)resultSet.getString("#PDESC");
    t = t.trim();
    utilityPart.setPartDesc(t);
    int resultCount = 0;
    int sameCond = 0;
    String storeName = null;
    String holdName = "No";
    int i = resultSet.getInt("PCOUNT");
    String cond;
    if(i == 1)
    String c = (String)resultSet.getString("#CONDS");
    c = c.trim();
    if(c.equals(""))
    cond = "N/A";
    else
    cond = c;
    utilityPart.setPartCondition(cond);
    utilityPart.setPartCount(i);
    else
    sqlMultCond = "SELECT #PART,#CONDS,COUNT(*) AS MCOUNT FROM MYLIB WHERE #PART = '" + s + "' AND #RECDT BETWEEN 20010816 AND 20020816 GROUP BY #PART,#CONDS ORDER BY #PART";
    getMultPartCond = conn.createStatement(java.sql.ResultSet.TYPE_SCROLL_SENSITIVE,java.sql.ResultSet.CONCUR_UPDATABLE);
    resultSetMultCond = getMultPartCond.executeQuery(sqlMultCond);
    int row =0;
    while(resultSetMultCond.next())
    row += 1;
    System.out.println("Row: " + row);
    resultCount = resultSetMultCond.getInt("MCOUNT");
    System.out.println("MCount: " + resultCount);
    if(holdName.equals("No"))
    System.out.println("You are in the no loop");
    storeName = (String)resultSetMultCond.getString("#CONDS");
    holdName = storeName;
    sameCond += 1;
    System.out.println("Same condition: " + sameCond);
    System.out.println("StoreName: " + storeName);
    System.out.println("HoldName: " + holdName);
    else
    storeName = (String)resultSetMultCond.getString("#CONDS");
    if(holdName.equals(storeName))
    sameCond += 1;
    System.out.println("Same condition: " + sameCond);
    System.out.println("StoreName: " + storeName);
    System.out.println("HoldName: " + holdName);
    resultSetMultCond.close();
    getMultPartCond.close();
    if(resultCount == sameCond)
    System.out.println("resultcount equals samecount");
    utilityPart.setPartCount(1);
    utilityPart.setPartCondition("same conditions everywhree");
    else
    System.out.println("resultcount not equal samecount");
    utilityPart.setPartCount(i);
    utilityPart.setPartCondition("");
    enum.addElement(utilityPart);
    }//end of first while
    if (rowsadded == 0 )
    res.sendRedirect("/PartNotFound.html");
    sess.putValue("PARTS",enum);
    resultSet.close();
    conn.close();
    getServletConfig().getServletContext().getRequestDispatcher("/NextQuery.jsp").forward(req,res);
    return;
    catch (SQLException e1)
    System.out.println(e1.getMessage());
    e1.printStackTrace();
    res.sendRedirect("/FindPartSQLError.htm");
    }//end of synchronized session
    }//end of else
    }//end of method

    Got the answer...changed my select statement in my second loop, did a group by CONDS which of course if they are all the same....the result set would only have one value therefore the loop will only execute once...took out the group by CONDS and ran fine....

  • Help with Trigger - looping through SELECT results

    How do I loop through a SELECT query within a Custom Trigger? I can
    execute the query fine, but the PHP mysql_xxx_xxx() functions don't
    appear to work inside a custom trigger. For example:
    This ends up empty:
    $totalRows_rsRecordset = mysql_num_rows($rsRecordset);
    While this returns the correct # of records:
    $totalRows_rsRecordset = $rsRecordset->recordCount();
    I need to loop through the records like I would with
    mysql_fetch_assoc(), but those mysql_xxx_xxx() don't seem to work.
    This works great outside a custom trigger, but fails inside a custom
    trigger:
    do {
    array_push($myArray,$row_Recordset['id_usr']);
    while ($row_Recordset= mysql_fetch_assoc($Recordset));
    What am I missing?
    Alec
    Adobe Community Expert

    Although the create trigger documentation does use the word "must", you are quite free to let the trigger fire during a refresh of the materialized view. Generally, you don't want the trigger to fire during a materialized view refresh-- in a multi-master replication environment, for example, you can easily end up with a situation where a change made in A gets replicated to B, the change fired by the trigger in B gets replicated back to A, the change made by the trigger in A gets replicated back to B, in an infinite loop that quickly brings both systems to their knees. But there is nothing that prevents you from letting it run assuming you are confident that you're not going to create any problems for yourself.
    You do need to be aware, however, that there is no guarantee that your trigger will fire only for new rows. For example, it is very likely that at some point in the future, you'll need to do a full refresh of the materialized view in which case all the rows will be deleted and re-inserted (thus causing your trigger to fire for every row). And if your materialized view does anything other than a simple "SELECT * FROM table@db_link", it is possible that an incremental refresh will update a row that actually didn't change because Oracle couldn't guarantee that the row would be unchanged.
    Justin

  • Looping through result set

    Hello, I am experience a heapdump while looping through a result set from a query I amr unning.
    Our system creates an instance of a transfer object representing one row in the result set for each row as it loops through. The result set brings back 36000 rows, so it is creating 36000 objects. As a result, a heapdump is occurring. What can be done to fix this error?

    even if it holds 360000 rows,
    I still think [zadok] idea is a great idea.
    you can get, for example first 1000 rows, cacluate it save result, and then get the next 1000 rows, is it make sense?
    if you still want to get it by one time, extend your vm mem, normal setting is 64M(I am not sure)

  • Looping through the resultset

    Post Author: Swapna
    CA Forum: Formula
    Hi
      I need to loop through the result set how would i do that here is my scenario
    in the database i have total 10 columns say an example
    a,b,c,d,e,f,g,h,i,j,k and assume i have 100 rows with allthese values in the database now for these 100 rows i have to calculate the summary of those columns and i have written formula something like this but it was not working it was giving me zero dont know plz advise on this
    whileprintingrecords;
    numbervar totalsum;
    totalsum=totalsum((a-b)/100cdefghi-j-k);
    and i want to display this sum in my detail section of report how would i do that
    I Appreciate your help.

    Post Author: SKodidine
    CA Forum: Formula
    Try this and see if you get any results.
    totalsum=totalsum((a-b)/100cdefghi-j-k);
    totalsum := totalsum((a-b)/100cdefghi-j-k);

  • Looping through several employee numbers

    My program calculates salary  for a given period for an employer and prints the result in a word doc using the function MS_WORD_OLE_FORMLETTER. This works fine when I have only one employer. When I enter several employee numbers the information is collected correctly in a table but only the first record is printed. I have an impression that the program executes as many times as there are employee numbers instead of executing once by looping through the employee numbers before printing the result. How can I print all the information for several employers?

    The shorter version of the code is as foolows:
    Loop at i_result into w_rt "loop through payroll results for given period
      case w_rt-lgart
      "do some calulations for this employee for
       FIELD-SYMBOLS: <fsd>, <fsl>   type any.
                 CONCATENATE 'MF' w_rt-lgart INTO keyA_Merge.
                 assign component keya_merge of structure T_MergeData to <fsd>.
                 if sy-subrc = 0.
                    <fsd> = <fsd> + w_rt-betrg.
                 endif.
    end case
    endloop
    append t_mergedata to Fdata
    "Now create mail merge for all employees using Fdata
    call function 'MS_WORD_OLE_FORMLETTER'
          exporting
            WORD_DOCUMENT             = FILEFORM
            HIDDEN                    = 0
            WORD_PASSWORD             =
            PASSWORD_OPTION           = 1
            FILE_NAME                 = FILEDATA
            NEW_DOCUMENT              =
            DOWNLOAD_PATH             = FILEPATH
           PRINT                     = PFPRINT
          tables
            DATA_TAB                  = FDATA
            FIELDNAMES                = pFIELDS
    My problem is that the loop executes for one Employee and then goes on to the end of the program to do the mail merge. the program then "restarts" for the necxt employee. However through each program run/cylce the table t_mergedata is appended with the correct information. I would like to first collect all this info before executing the FM for all the records in t_mergedata.

  • Looping through XML Items

    Hi,
    I am selecting data from tables in forms of xml like below
    xml_data VARCHAR2(32000) :=
    SELECT XMLELEMENT("form",
    xmlagg(xmlelement("item",
    XMLFOREST(form_seq_no "form_seq_no",
    patientid "patientid",
    facilityid "facilityid"
    from (SELECT
    e.form_seq_no,
    e.patientid,
    e.facilityid
    FROM hosp e
    I am using a cursor like below to get the data
    OPEN l_rc FOR xml_data;
    LOOP
    if l_rc%notfound then
    EXIT ;
    end if;
    FETCH l_rc
    INTO l_xml;
    update hosp set transmit_date = sysdate;
    end loop;
    CLOSE l_rc;
    The above query returns all items in the table....I am trying to limit the number of records returned based on limit I pass...If the user enters 2, only two items from the node has to be returned. I am not having a clue on how to do this. It would be great if any one can help me...

    Thank you both for the replies. I am able to get the data based on the limit I pass...I have another question.
    Once the xml doc result is returned or once the select operation is performed and cursor data is fetched into a xmltype variable, I am updating a table's data with the current date...But I have to update the table based on the form_seq_no in the result xml doc...If the result set has three records, then it would have three different form_seq_no. Right now I am doing like below
    SELECT XMLELEMENT("form",
    xmlagg(xmlelement("item",
    XMLFOREST(form_seq_no "form_seq_no",
    patientid AS "patientid",
    facilityid AS "facilityid" ))))
    INTO l_xml
    from (SELECT
    e.form_seq_no,
    e.patientid,
    e.facilityid
    FROM hosp e
    ORDER BY e.form_seq_no
    WHERE ROWNUM < p_num_of_rows;
    I am using a cursor like below to get the data
    OPEN l_rc FOR xml_data;
    LOOP
    if l_rc%notfound then
    EXIT ;
    end if;
    FETCH l_rc
    INTO l_xml;
    This is the update I am doing, based on the result set I pasted below....But I get an error that extractValue can return only one child...I am at loss to know how to loop through the result set and perform the update...
    update hosp set transmit_date = sysdate where form_seq_no = extractValues(l_xml, 'form/item/form_seq_no);
    end loop;
    CLOSE l_rc;
    If I give rownum <3 , I get 3 rows, the result set might look like as follows:
    <form>
    <item>
    <form_seq_no>1</form_inst_seq_no>
    <patientid>21</patientid>
    <facilityid>23</facilityid>
    </item>
    <item>
    <form_seq_no>2</form_inst_seq_no>
    <patientid>212</patientid>
    <facilityid>233</facilityid>
    </item>
    <item>
    <form_seq_no>3</form_inst_seq_no>
    <patientid>213</patientid>
    <facilityid>234</facilityid>
    </item>
    I am new to this xml and xml manipulation in oracle...What are the concepts I would have to know in order to achieve my task above? And Right now I have this book called "Oracle Database 11g The Complete Reference" by Kevin Loney, but I neither find any elaborate explanations nor examples. What other books would anyone suggest to learn more on oracle and pl/sql.
    Thanks a lot in advance.

  • Looping through results of a Select through a DB adapter

    I am selecting an unknown number of rows from a database through the DB adapter into my process. When I get these results I need to loop through them, but the examples I have seen require an attribute to define each row for the loop to work . My result set is not giving me an attribute and I do not see how to define one in the wizard used to define the adapter.
    Is there a way to assign an attribute to each row automatically as it comes out or after the fact? Or is there another way to attack this problem that I do not see?
    Thank you in advance for the help.
    --Mike                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    you can take the results payload and loop thru with the while statement, then you can iterate thru each result and doing whatever you need to. Just make a counter variable of type int and count the number of records in the payload, then initialize a iterator varible on int and set to 0.
    then just loops thru the payload and add +1 to iterator until it reaches the count number. This allows you to hit each records one by one, and do any kind of analysis on the current record set.

  • Loop through result set and delete row

    so here is what I need -
    I have a query that pulls rows from the Database through a stored procedure.(these are properties in an area)
    Before I start looping through the query, I need to check the distance between my current location and the property. If it less than 5 miles, only then should I display that property. The distance in miles will be chosen while submitting the search form.
    So is there a way to delete rows from the result set based on the criteria? Or
    Is there a better way to accomplish this? I am using the the google api to get the latitudes and longitudes. The other issue to keep in mind is the load time.
    Thanks

    You can do this the easy way or the hard way.  Depends on whether your condition that needs to be checked can be expressed in the form of a SQL where clause.  If it can, then do what BKBK suggested, and use a query of query to create a new resultset that only has the rows from the original resultset that don't meet your condition.
    If the calculation of the condition is more complex, then do a CFLOOP over the query and examine each row to see if you want to keep it or toss it.  if you want to toss it, the delete that row - there is a function in CFLIB.ORG called querydeleterow that should help you.  Or, you could just clear out the row's contents and then do the query of query as described in BKBK's post to create a new resultset that doesn't include the blank rows.

  • How do I loop through tables, not columns in a table?

    Sorry if this is a long one. My problem is actually quite simple. I am trying to write either an ad hoc PL/SQL block or a stored procedure to loop 18 times (thru 18 tables) and perform a SQL query on those tables, returning 18 resultsets. I would like the results to show up on the screen (or in a spool file, whatever).
    So far I have tried 3 different approaches, none of which have worked.
    1. I tried to assign the select query to a variable (qry) and use EXECUTE IMMEDIATE qry. This forced me thru a variety of errors to declare variables and assign the result to them--EXECUTE IMMEDIATE qry into nm0, nm1, nm2...
    The problem with that was the resultset returned more than the variable was built for as there might be no rows returned, or it might be a thousand rows of data. So I tried changing the variables to VARRAYS, but it gave me a type mismatch as the underlying columns were NUMBER and VARCHAR2.
    DECLARE
         ctr number;
         TYPE NUMLIST IS VARRAY (1000) OF NUMBER;
         TYPE VARLIST IS VARRAY (1000) OF VARCHAR2(15);
         nm0 NUMLIST NOT NULL DEFAULT 1;
         nm1 VARLIST;
         nm2 NUMLIST NOT NULL DEFAULT 1;
         nm3 VARLIST;
         nm17 NUMLIST NOT NULL DEFAULT 1;
         qry VARCHAR2(2000) := 'klx_uln_p000_cells';
    BEGIN
    FOR ctr IN 1..17 LOOP
         IF ctr &lt; 10 THEN
              qry := 'SELECT
              A.DIM_0_INDEX,
              S0.SYM_NAME,
              A.DIM_1_INDEX,
              S1.SYM_NAME,
              A.DIM_2_INDEX,
              S2.SYM_NAME,
              A.DIM_3_INDEX,
              S3.SYM_NAME,
              A.NUMERIC_VALUE,
              B.NUMERIC_VALUE
              FROM
              KHALIX.klx_uln_p00'||ctr||'_cells A,
              KHALIX.klx_ucn_p00'||ctr||'_cells B,
              KHALIX.KLX_MASTER_SYMBOL S0,
              KHALIX.KLX_MASTER_SYMBOL S1,
              KHALIX.KLX_MASTER_SYMBOL S7
              WHERE
              A.DIM_0_INDEX=B.DIM_0_INDEX AND
              A.DIM_1_INDEX=B.DIM_1_INDEX AND...
              A.DIM_7_INDEX=S7.SYM_INDEX';
         ELSE
              qry := 'SELECT
              A.DIM_0_INDEX...
              A.DIM_7_INDEX=S7.SYM_INDEX';
         END IF;
         BEGIN
         dbms_output.put_line('SELECT FOR KLX_ULN_P00'||ctr||'_CELLS');
         dbms_output.put_line(nm16);
         dbms_output.put_line(nm17);
         EXECUTE IMMEDIATE qry into nm0,nm1,nm2,nm3,nm4,nm5,nm6,nm7,nm8,nm9,nm10,nm11,nm12,nm13,nm14,nm15,nm16,nm17;
    --     dbms_output.put_line(qry);
         dbms_output.put_line(nm16);
         dbms_output.put_line(nm17);
         EXCEPTION
              WHEN NO_DATA_FOUND THEN
                   dbms_output.put_line('No data found for Query '||ctr);
         END;
    END LOOP;
    EXCEPTION
         WHEN NO_DATA_FOUND THEN
              dbms_output.put_line('No data found for Query '||ctr);
    END;
    2. So then I used REF CURSOR to create a stored procedure and return the values. That allowed me to run my query AND tokenize the tablenames with a counter so that it would loop through the different tables! However, I still could not get it to display the results without going to SQL Plus and typing 'print c;'.
    3. So, finally I tried to create a looping wrapper around the ref cursor to have some variable (ctr) increment so my query would get performed on table0_cells through table17_cells. This, too, did not work.
    If I manually go to SQL Plus and type:
    variable ctr number
    begin
    :ctr := 1;
    end;
    exec dupe_find(1,:c);
    it will execute for the first table (klx_uln_p001_cells) and I can then type 'print c' to see what was returned. But when I try putting this within a wrapper PL/SQL block with a Loop to make ctr go from 0 - 17 (to loop through table_names klx_uln_p000_cells to klx_uln_p017_cells), it does not work.
    Help! It should be very simple to loop through tables, shouldn't it? I just want a script that will loop through tables, perform a query on each table and display the results. For some reason, I can only find documentation examples on looping through columns that are all in the same table.
    Dave

    Here's a working example using your first strategy ...
    create table t1 (id number);
    create table t2 (id number);
    insert into t1 values (100);
    insert into t1 values (101);
    insert into t2 values (200);
    insert into t2 values (201);
    declare
    v_table_name user_tables.table_name%type;
    type ttab_id is table of t1.id%type index by binary_integer;
    tab_id ttab_id;
    begin
    for i in 1 .. 2 loop
    v_table_name := 't' || i;
    execute immediate 'select id from ' || v_table_name
    bulk collect into tab_id;
    dbms_output.put_line('query from ' || v_table_name);
    for j in 1 .. tab_id.count loop
    dbms_output.put_line(tab_id(j));
    end loop;
    end loop;
    end;
    There are many other ways to do this (especially if you need to do more than just print out the data).
    Richard

  • Looping through an XML file

    I got this really great script that loops through some XML files and does stuff based off the content.
    What I would like to do now is have it repeat when it gets to a certain field. for example my xml file would look like this.
    <xml>
    <fileName>nameoffile</fileName>
    <userEmail>[email protected]</userEmail>
    <commandList>
    <item>info here</item>
    <item>more info here</item>
    <item>yet more info</item>
    <item>still more info here</item>
    </commandList>
    </xml>
    then basically i need the applescript to see the <commandList> tag and then repeat for each item.
    i can't seem to wrap my head around how to get it to happen.
    currently I am using this to extract the normal tags from the xml file
    set theXML to choose file
    tell application "System Events"
    tell XML element 1 of contents of XML file theXML
    set the fileName to value of (XML elements whose name is "fileName")
    ... and so on
    end tell
    end tell
    i believe i have to put an if statment in saying that if the element name == "commandList" then
    repeat with item in commandList
    my stuff here.
    end repeat
    but i'm not sure how to build the statement.
    thanks for any help.
    P

    Something like this?
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    set theXML to POSIX path of (choose file)
    tell application "System Events"
    tell XML element 1 of contents of XML file theXML -- root element
    set the fileName to value of XML element "fileName"
    get value of XML elements of XML element "commandList" -- sub elements
    repeat with anItem in the result
    log anItem
    end repeat
    end tell
    end tell
    </pre>

  • How to loop through Multiple Excel sheets and load them into a SQL Table?

    Hi ,
    I am having 1 excel sheet with 3 worksheet.
    I have configured using For each loop container and ADO.net rowset enumerator.
    Every thing is fine, but after running my package I am getting below error
    [Excel Source [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009.  There may
    be error messages posted before this with more information on why the AcquireConnection method call failed.
    Warning: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.  The Execution method succeeded, but the number of errors raised (5) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified
    in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
    [Connection manager "Excel Connection Manager"] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
    An OLE DB record is available.  Source: "Microsoft Access Database Engine"  Hresult: 0x80004005  Description: "The Microsoft Access database engine cannot open or write to the file ''. It is already opened exclusively by
    another user, or you need permission to view and write its data.".
    Pleas suggest me the correct way of solving above issues.
    Thanks in advance :)
    regards,
    Vipin jha
    Thankx & regards, Vipin jha MCP

    Hi ,
    Please refer the below link for Looping multiple worksheet in a single SQL Table.
    http://www.singhvikash.in/2012/11/ssis-how-to-loop-through-multiple-excel.html
    Note:-If you using excel 2010 then you have to use EXCEL 12.0 .
    Above link explaining  step by step of Looping multiple worksheet in a single SQL Table.
    regards,
    Vipin jha
    Thankx & regards, Vipin jha MCP

  • How do I Loop through a recordset using PHP

    I have a recordset containing a MySql table with 5 columns, each one containing an email address of an official in a club.
    Each row represents a different club, and each column a different type of official.
    The first column represents chairmen, the next treasurers etc...
    The recordset is called $mailset.
    I need to loop through each row of $mailset and extract the email addresses of each column and concatenate them into a string seperated by semi colons ; so it ends up like this:
    [email protected];[email protected];[email protected]; and so on.
    This is how the recordset is set up:
    mysql_select_db($database_dummyread, $dummyread);
    $query_mailset = "SELECT club_chair_email, club_treas_email, club_sec_email, club_delegate_email, club_deputy_email FROM clubs";
    $mailset = mysql_query($query_mailset, $dummyread) or die(mysql_error());
    $row_mailset = mysql_fetch_assoc($mailset);
    $totalRows_mailset = mysql_num_rows($mailset);
    ?>
    I tried using a  loop to step through the recordset, but it always shows the first record, so its not moving the pointer through the file.
    The pseudo code aught to be something like this:
    Initialise variables and move to the first record
    If there are records to process
                   Read a record
                        Process all columns
                Move on to the next record
    else
         if there are no records
              print an error message
    else
    Print the results.
    Can anyone give me a hint as to how to move from row to row in a recordeset under the control of a loop.
    I am using PHP and MySql. (as far as I know, it is the original - not PDO or MySqli)

    Each call to mysql_fetch_assoc($mailset) retrieves the value at the current location and increments the pointer in the recordset array. So use either a do or while loop and call mysql_fetch_assoc($mailset) from within the loop.
    From the docs:
    Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. mysql_fetch_assoc() is equivalent to calling mysql_fetch_array() with MYSQL_ASSOC for the optional second parameter. It only returns an associative array.

  • How do I: Loop through Application objects

    How would I loop through the application object?  My goal is to see if the object is a label and change its font size.
    pseudocode would look like this:
    function setsize(change int) {
      for each obj in application {
        if obj is of type label {
          set font size to font size + change
    Once I got that working, I'd add other objects that display text.  The "change" would be a number to increase (positive) or decrease (negative) the size.
    Thanks,
    Jerry

    I have this:
              <mx:HBox id="resultTextBox"
                  width="100%"
                  verticalScrollPolicy="off" horizontalScrollPolicy="auto">
                  <mx:Label id="resultPotentialResultsLabel"
                      text="Food Stamp potential eligibility for household, estimated monthly benefit amount "
                      styleName="textNormal"
                      toolTip="Results message"
                      tabIndex="200" tabEnabled="true"  fontSize="40"/>
                  <mx:Text id="resultPotentialResultsData"
                      styleName="resultNumberNormal"
                      toolTip="Final results"
                      tabIndex="202" tabEnabled="true" />
              </mx:HBox>
    When I expand the font size it pushes the "resultPotentialResutsData" to limbo.  I tried adding the horizonal scroll bar to allow the user to still see the results,  The scroll doesn't appear.
    1) is there a way to get the box to expand to fix the content?
    2) is there a way to get the scroll bar to appear when needed?
    3) is there a way to wrap the text (in this case the second field) in the HBox?

  • Looping through files with Regular expressions ?

    Hi,
    My Question is:
    if i have the following Regular Expression,
    String regrex = "tree\\s\\w{1,4}.+\\s=\\s(.*;)";
    The file in which i am looking for the string has multiple entries, is it
    possible to do another regular expression on the captured group (.*;)
    which is in the original Regular expression ?
    The text that is captured by the RE is of the type "(1,(2,((3,5),4)));" for
    each entry, and different entries in the file have slightly different syntax
    is it possible to loop through the file and first of all check for the presence
    of the original RE in each entry of the file
    and then secondly, check for the presence of another RE on the captured group?
    [ e.g. to check for something like, if the captured group has a 1 followed by a 3
    followed by a 5 followed by a and so on ].
    Thanks Very much for any help, i've been struggling with this for a while!!
    Much appreciated
    The code that i have so far is as follows:
    import java.util.*;
    import java.util.regex.*;
    import java.io.*;
    import java.lang.*;
    import javax.swing.*;
    public class ExpressReg {
    public String Edit;
    public ExpressReg(String editorEx){
    Edit = editorEx; // Edit = JTextArea
    String regrex = "tree\\s\\w{1,4}.+\\s=\\s(.*;)";
    //String regrex1 = "(.*;)";
    Pattern p = Pattern.compile(regrex);
    Matcher m = p.matcher(editorEx); // matcher can have more than one argument!
    boolean result = m.find();
    if(result){                           
    JOptionPane.showMessageDialog(null, "String Present in Editor");
    else if(!result){
    JOptionPane.showMessageDialog(null, "String Not Present In Editor");

    if i have the following Regular Expression,
    String regrex = "tree\\s\\w{1,4}.+\\s=\\s(.*;)";
    The file in which i am looking for the string has multiple entries, is it
    possible to do another regular expression on the captured group (.*;)
    which is in the original Regular expression ?Yes, the capturing group is $1 (the only one) referenced in source code as m.group(1).
    m.group() will return entire matching.
    simply use this way:
    String result = m.group(1);
    // your stuff: could be another validation
    The text that is captured by the RE is of the type "(1,(2,((3,5),4)));" for
    each entry, and different entries in the file have slightly different syntax
    is it possible to loop through the file and first of all check for the presence
    of the original RE in each entry of the file
    and then secondly, check for the presence of another RE on the captured group?Again "Yes", no limits!
    Don't need to create another Matcher, just use m.reset(anotherSourceString)..loop using the same pattern.
    Note: Take care with ".*" because regex nature is "greedy", be more specific, eg.: "\\d" just matches digits (0-9).
    Can you give us some sample of "slight difference" ?

Maybe you are looking for

  • Can't figure out how to keep two different sites...

    How can I keep two sites and be able to get to both of them. When I create an iMovie and go to the share tab to share it wants to put it in the last site I created. What if that's not the site I want it on? I can't figure out how to go back and forth

  • How to create table in interactive form via Java Web Dynpro

    Hi, How to create table in interactive form via Java Web Dynpro ? Any online tutorial / example ? Thank you. Regards, Eric

  • Trying to update Photoshop CS6 with latest Camera Raw but no luck!!

    Working on a Corporate Licensed CS6 and the "Updates" under Help is grayed out? I have a license key, I have logged on to Adobe and I am an admin. Still it's grey. So I went on the internet and found a lot of pages telling me it is easy to download a

  • Count # weeks in a date range...how?

    Greetings: I've a sql statement to find me the begining & ending dates for a date range that must begin on Sunday and end on a Saturday. SELECT (NEXT_DAY(TO_DATE(p_start_dt, 'MM/DD/YYYY'), 'SATURDAY')) - 6, (NEXT_DAY(TO_DATE(p_end_dt, 'MM/DD/YYYY'),

  • Option Key Not Working Correctly

    Hi All, I'm having a very strange issue with my Option Key all of a sudden. It has stopped functioning as an Option Key and will ONLY increase the volume setting. When I bring up the keyboard viewer the Option Key won't register, it just turns up the