Hello,

I am developing a report which should be written by using direct sql
statements. I recognized a problem about direct sql if anybody helps
me i will be very pleased. The problem is i could not write while
loops one within the other.For example;

Connection Con = new Connection();
Statement Stmt = Con.createStatement();
ResultSet R,R1;
sql ='SELECT ACCOUNTNUM,ACCOUNTNAME,ACCOUNTPLTYPE,RECID FROM
LEDGERTABLE WHERE ACCOUNTNUM <= \'699\'ORDER BY ACCOUNTNUM';
   R=Stmt.executeQuery(sql);
   while (R.next())
  {

        acno1=R.getString(1);
        i = R.getInt(3);
        k= R.getString(4);
        if(strlen(acno1)==3)
        {
            if(i==LedgerAccountType::sum)
            {

            sql = 'SELECT FROMACCOUNT,TOACCOUNT FROM
LEDGERTABLEINTERVAL WHERE ACCOUNTTABLEID ='+_tableId+' AND
ACCOUNTRECID = '+k+'';
            R1 =   Stmt.executeQuery(sql);
            while(R1.next())
            {
                print R1.getString(1),' ',R1.getString(2),' ',k;
                pause;
            }

            }
            else
            {
//blaaaa.....
            }
       }acno1
    } ledgertable2

it just takes the first value from the second resultset and then go
out of the loop.

best wishes...
 







Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to