You can use the following code as an example , just replace your database name ,
userid and password at the correct places

Santosh

<%@page import="java.sql.*;"%>
<%@page import="java.io.*;"%>
<html>
<h1>Employee Detail Information</h1>
<body>

 <%
     try
     {
     String tabName = "employee";//whatever table you want to retrieve from
     Statement stmt1 =null;
     String query,cono,ssn;

     cono=request.getParameter("cono");
     ssn=request.getParameter("ssn");

     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     String url = "jdbc:odbc:dsnname"; //replace with actual dsn name
     Connection conn =
DriverManager.getConnection(url,"userid","password");//replace userid and
password too

     stmt1 = conn.createStatement();

     query = "select ssn,fname,lname from client.employee "+
     "where cono ='"+cono+"'";//your query
     ResultSet rs = stmt1.executeQuery(query);
     out.println("Company Number :"+cono);
     %>
     <br>
     <%
     while(rs.next())
     {
     out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));
     %>
     <br>
     <%
     }//end of while


     rs.close();
     stmt1.close();
     conn.close();
     }
     catch(Exception e)
     {
     out.println(e.getMessage());
     }

     %>
</body>
</html>

===========================================================================
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

Reply via email to