hi friends,
i have a problem. i am wroking jsp using Acess it will works
fine. but the same querey i am ascess through oracle it wont work
properly.the prgrame is like tree view .
here i written my code:
<%
String t11 =null;
String t12 =null;
try
{
String reh=request.getParameter("newt");
String rem=request.getParameter("newm");
String asrep1=request.getParameter("asrep");
int asrep2=Integer.parseInt(asrep1);
String r=request.getParameter("rrepid");
String ca=request.getParameter("catid");
String titl=request.getParameter("title");
int p=Integer.parseInt(request.getParameter("pos1"));
int tit=Integer.parseInt(request.getParameter("titid"));
String u=request.getParameter("usname");
String msgd=request.getParameter("msgdate");
String parid2=request.getParameter("parentid");
String Cat=request.getParameter("value");
int iw=0;
int titleid=0;
int assrepid1=0;
int temptitleid=0;
int assrepid=0;
int pari11=0;
boolean matchfound=true;
Connection conn;
try
{
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
// Connect to the database
conn =
DriverManager.getConnection("jdbc:oracle:thin:@oracle:1521:portaldb","portaldb","portaldb");
Statement stmt1=conn.createStatement (
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
conn.setAutoCommit(false);
stmt1.executeUpdate("UPDATE msgdf SET flag=0");
Statement stmt2=conn.createStatement (
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
Statement stmt3=conn.createStatement (
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
ResultSet rs2=stmt1.executeQuery("SELECT
title,titleid,parentid,assrepid,postion1 FROM msgdf where parentid=0 and
assrepid=0 and catid="+Integer.parseInt(ca)+" and titleid="+tit+" and
status='A' order by titleid");
while(rs2.next())
{
int par1=Integer.parseInt(rs2.getString("titleid"));
int maintitleid=par1;
int pd=Integer.parseInt(rs2.getString("parentid"));
int as=Integer.parseInt(rs2.getString("assrepid"));
int po1=Integer.parseInt(rs2.getString("postion1"));
assrepid=par1;
%><bgcolor=#EEEEEE><img src="folder.gif" border=0>
<A
href="reply3.jsp?value=<%=java.net.URLEncoder.encode(request.getParameter("value"))%>&titid=<%=par1%>&asrep=<%=as%>&catid=<%=ca%>&pos1=<%=po1%>&parid=<%=pd%>&pcatid=<%=pcatid%>">
<%out.println(rs2.getString(1)); %></A><br><%
int partitle=par1;
if(assrepid!=0)
{
do
{
if(assrepid!=0)
{
ResultSet rs5=stmt2.executeQuery("SELECT title,
titleid,assrepid,postion1,parentid FROM msgdf where flag=0 and
parentid="+partitle+" and status='A' order by parentid,titleid");
//out.println(" par1 : " + par1 +"<br>");
while(rs5.next())
{
int
asr1=Integer.parseInt(rs5.getString("assrepid"));
//out.println(asr1);
int
po=Integer.parseInt(rs5.getString("postion1"));
int
ti1=Integer.parseInt(rs5.getString("titleid"));
int
pari1=Integer.parseInt(rs5.getString("parentid"));
String indent;
indent =" ";
if(par1-asr1==0)
{
for (int i=0; i<=po; i++)
{
indent=indent + " ";
}
assrepid=asr1;
par1=ti1;
out.println(indent);
%>
<img src="folder.gif" border=0>
<A
href="reply3.jsp?value=<%=java.net.URLEncoder.encode(request.getParameter("value"))%>&titid=<%=ti1%>&asrep=<%=asr1%>&catid=<%=ca%>&pos1=<%=po%>&parid=<%=pari1%>&pcatid=<%=pcatid%>">
<%out.println( rs5.getString(1));
%></a><br><%
stmt3.executeUpdate("UPDATE msgdf SET flag=1
where titleid="+ti1+" ");
titleid=ti1;
matchfound=true;
}
}
if (matchfound==false)
{
assrepid=0;
titleid=par1;
par1=0;
}
}
else
{
ResultSet rs6=stmt2.executeQuery("SELECT
titleid,assrepid,flag,parentid from msgdf where titleid in (select
distinct(assrepid) from msgdf where titleid="+titleid+")and status='A' " );
while(rs6.next())
{
int
titl2=Integer.parseInt(rs6.getString("titleid"));
int
parentid=Integer.parseInt(rs6.getString("parentid"));
int partitleid=titl2;
ResultSet
rs9=stmt2.executeQuery("SELECT title,
titleid,assrepid,postion1,parentid FROM msgdf where flag=0 and
parentid="+partitle+" and status='A' order by parentid,titleid");
while(rs9.next())
{
int
asr1=Integer.parseInt(rs9.getString("assrepid"));
int
pos=Integer.parseInt(rs9.getString("postion1"));
int
ti=Integer.parseInt(rs9.getString("titleid"));
int
pari=Integer.parseInt(rs9.getString("parentid"));
String indent
=" ";
//out.println(partitleid);
if
(partitleid-asr1 == 0)
{
for (int i=0; i<=pos;
i++)
{
indent=indent
+ " ";
}
out.println(indent);
%><bgcolor=#EEEEEE><img
src="folder.gif"
border=0>
<A
href="reply3.jsp?value=<%=java.net.URLEncoder.encode(request.getParameter("value"))%>&titid=<%=ti%>&asrep=<%=asr1%>&catid=<%=ca%>&pos1=<%=pos%>&parid=<%=pari%>&pcatid=<%=pcatid%>">
<%
assrepid=asr1;
out.println(rs9.getString(1));
%></a><br><%
stmt3.executeUpdate("UPDATE msgdf
SET flag=1 where titleid="+ti+" ");
partitleid=ti;
titleid=partitleid;
par1=titleid;
matchfound=true;
}
}
if (matchfound==false)
{
assrepid=0;
par1=0;
titleid=partitleid;
}
//function implementation is over
// out.println(" PARTITLEID : " + partitleid
+ " MATCHFOUND"
+matchfound+"<br>");
}
}
par1=assrepid;
matchfound=false;
}while(titleid!=maintitleid);
}
}
conn.close();
}
catch ( SQLException ex )
{
System.out.println ( "SQL" );
}
}
catch ( NullPointerException ex )
{
System.out.println ( "Null" );
}
%>
please explain.
thanks subu
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets