anvi123
Programmer
- Mar 27, 2008
- 3
With the below code I am getting the output as below.I am getting data from database as shown in the code
Displaying All Users
FirstName LastName UserName Password
Ann go ago VVVV
ffff ffff ffff ffffff
sag rag tom kim
gen man rfff kkk
fff jjj hhh hhh
...so on.
But I have to display as shown below. Is it possible or Not. if it possible, How would show that, Please let me know ASAP
FirstName aaaa aaaa anna ggg henn ffff hhh jjj kkk llll oooo pppp mmmm jjjjj kkkkkkk llllllll gggg qqqqq
LastName ssss ffff ggg hhh nnn kkk lll bbb vvvv ssss aaaa qqqq w ssss aaaa zzzz bbbb nnnnn
UserName ....so on
Password
<%@ page session ="false"%>
<%@ page import ="java.sql.*"%>
<%
try{
Class.forName(("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("JDBC driver loaded");
}catch(ClassNotFoundException e){
System.out.println(e.toString());
}
%>
<HTML>
<HEAD>
<TITLE> Display ALL Users<TITLE>
</HEAD>
<Body>
<BR><H2>Displaying ALL Users</H2>
<BR>
<BR>
<TABLE>
<TR>
<TH> First Name </TH>
<TH> Last Name </TH>
<TH> User Name </TH>
<TH> Password</TH>
</TR>
<%
String sql = "select firstname, lastname, username, password" +"from Users";
try{
Connection con = DriverManager.getConnection("jdbcdbc:JavaWeb");
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sql);
while(rs.next()) {
%>
<tr>
<td><% out.print(rs.getString(1); %></TD>
<td><% out.print(rs.getString(2); %></TD>
<td><% out.print(rs.getString(3);%></TD>
<td> <% out.priint(rs.getString(4));%></TF>
</tr>
<%
}
rs.close();
s.close();
con.close();
}
cath(SqlException e) {
}
catch(Exception e) {
}
%>
</Table>
</center>
</body>
</html>
Thanks a lot.
Displaying All Users
FirstName LastName UserName Password
Ann go ago VVVV
ffff ffff ffff ffffff
sag rag tom kim
gen man rfff kkk
fff jjj hhh hhh
...so on.
But I have to display as shown below. Is it possible or Not. if it possible, How would show that, Please let me know ASAP
FirstName aaaa aaaa anna ggg henn ffff hhh jjj kkk llll oooo pppp mmmm jjjjj kkkkkkk llllllll gggg qqqqq
LastName ssss ffff ggg hhh nnn kkk lll bbb vvvv ssss aaaa qqqq w ssss aaaa zzzz bbbb nnnnn
UserName ....so on
Password
<%@ page session ="false"%>
<%@ page import ="java.sql.*"%>
<%
try{
Class.forName(("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("JDBC driver loaded");
}catch(ClassNotFoundException e){
System.out.println(e.toString());
}
%>
<HTML>
<HEAD>
<TITLE> Display ALL Users<TITLE>
</HEAD>
<Body>
<BR><H2>Displaying ALL Users</H2>
<BR>
<BR>
<TABLE>
<TR>
<TH> First Name </TH>
<TH> Last Name </TH>
<TH> User Name </TH>
<TH> Password</TH>
</TR>
<%
String sql = "select firstname, lastname, username, password" +"from Users";
try{
Connection con = DriverManager.getConnection("jdbcdbc:JavaWeb");
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sql);
while(rs.next()) {
%>
<tr>
<td><% out.print(rs.getString(1); %></TD>
<td><% out.print(rs.getString(2); %></TD>
<td><% out.print(rs.getString(3);%></TD>
<td> <% out.priint(rs.getString(4));%></TF>
</tr>
<%
}
rs.close();
s.close();
con.close();
}
cath(SqlException e) {
}
catch(Exception e) {
}
%>
</Table>
</center>
</body>
</html>
Thanks a lot.