Yogen Vadnere

Ranch Hand
+ Follow
since Sep 20, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Yogen Vadnere

If possible, pl post ur code so that everyone can test on there own platform and let u know.
23 years ago
JSP
Hello,
DatabaseMetaData has two methods
getPrimaryKeys(String catalog, String schema, String table)
Hope this will work for u..
check for case sensitivity also
I guess following code will work..
while (rsConstituent.next()) {
String num = rsConstituent.getString("Constituent_Id");
int tempInt = java.util.Arrays.binarySearch(value,num)
if(tempInt < 0)
System.out.println("Not found");
else
System.out.println("found at "+tempInt);
}
This is sample code...
Hope this will help u..
<br><br>
File : dispexcel.jsp<br>
<br>
<html>
<%
String convert = request.getParameter("go") ;
if(convert != null && convert.toUpperCase().equals("Y")){
response.setContentType("application/vnd.ms-excel");
}
%>
<table>
<tr>
<td>Name</td>
<td>Phone</td>
</tr>
<tr>
<td>Yogendra</td>
<td>513 674 7375</td>
</tr>
<tr>
<td>
<%
if(convert == null | | convert.toUpperCase().equals("N")){
%>
<form name=myform target="NEW" action=dispexcel.jsp >
<input type=submit value="convert to excel">
<input type=hidden value="Y" name=go>
<%
}
%>
</td>
</tr>
</form>
</table>
</html>
23 years ago
To get yday use following...
new Date(System.currentTimeMillis() -(24*60*60*1000))
Hope this will help u...
23 years ago
try this...
<input type=text value="javaranch" disabled>
23 years ago
u can use array in vector or vector in vector
1. array in vector
Vector retuVector = new Vector() ;
while((imsRst!=null) && imsRst.next()){
String tempStrin[] = new String[3] ;
tempStrin[0] = myRst.getString("user_name") ;
tempStrin[1] = myRst.getString("user_city") ;
tempStrin[2] = myRst.getString("user_zip") ;
retuVector.addElement(tempStrin) ;
}

2. vector in vector
Vector retuVector = new Vector() ;
while((imsRst!=null) && imsRst.next()){
Vector myVector = new Vector() ;
myVector.addElement(myRst.getString("user_name")) ;
myVector.addElement(myRst.getString("user_city")) ;
myVector.addElement(myRst.getString("user_zip")) ;
retuVector.addElement(myVector) ;
}

Hope this will help u..
I solved it by myself.
Thankx
23 years ago
Hello All,
How to do the following ,
I am generating one report using jsp and at client side i want to convert that report into excel format(ofcourse after clicking button) and open the excel at client machine and show the report.
Thankx in advance.
Yogen
23 years ago
I would suggest two ways
1. use array in vector

Vector returnVector = new Vector() ;
while(rst.next()){
String[] tempString = new String[3] ;
tempString[0] = rst.getString("name") ;
tempString[1] = rst.getString("address") ;
tempString[2] = rst.getString("city") ;
returnVector.addElement(tempString)
}
2. vector in vector

Vector returnVector = new Vector() ;
while(rst.next()){
Vector tempVector = new Vector();
tempVector.addElement(rst.getString("name")) ;
tempVector.addElement(rst.getString("address")) ;
tempVector.addElement(rst.getString("city")) ;
returnVector.addElement(tempVector)
}
Hope this will help u.
here is the sample code for resultset to vector
try{
String sqlString = "SELECT user_name FROM user" ;
ResultSet myRst = con.executeQuery(sqlString) ;
Vector retuVector = new Vector() ;
while((imsRst!=null) && imsRst.next()){
retuVector.addElement(myRst.getString("user_name")) ;
return retuVector ;
}catch(SQLException ex){
return new Vector() ;
}