Hi all

I am new to JSP, This is my .jsp file when i am Executing i am getting lot
of errors please tell me where i am doing wrong please......

Please correct this bellow code i am doing wrong.....

-Suresh

<html>
<head>
<title> add head item & Classifications </title>
</head>

<%@ page language="java" import="java.sql.*" %>

<body>

<%

try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   }
   catch(java.lang.ClassNotFoundException ex) { }

   String headitem_name      = request.getParameter("headitem_name");
   String clasi_name1        = request.getParameter("clasi_name1");
   String clasi_name2        = request.getParameter("clasi_name2");
   String clasi_name3        = request.getParameter("clasi_name3");
   String clasi_name4        = request.getParameter("clasi_name4");
   String clasi_name5        = request.getParameter("clasi_name5");

/* making connection.The second step in establishing a connection is to have
the appropriate
   driver connect to the DBMS. The following line of code illustrates the
general idea    */

   String url="jdbc:odbc:Inventory";

/* where "inventory" is the system dsn name */

   Connection con=DriverManager.getConnection(url, "sa", "");

/* where "sa is the username to access the database and password is Driver
   Manager's getconnection method estabilishes connection with the database
   specified in the JDBC URLThen create jdbc statement */

   Statement stmt = con.createStatement();

 begin

 declare
 @s1 varchar(100),
 @s2 varchar(100),
 @s3 varchar(100),
 @s4 varchar(100),
 @s5 varchar(100),
 @s6 varchar(100),
 @count int

 select @count = 0
 select @s1 = '%clasi_name1%'
 select @s3 = '%clasi_name3%'
 select @s4 = '%clasi_name4%'
 select @s5 = '%clasi_name5%'
 select @s6 = '%headitem_name%'

 declare @i6 int
 select @i6 = 1

  CallableStatement cstmt1 = con.prepareCall("{call headitemcode(@s6)}");
  CallableStatement cstmt2 = con.prepareCall("{call
subitemcode(@s1,@s2,@s3,@s4,@s5)}");

 String query1 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query2 ="values('" +@s6+"','" +headitem_name+ "','" +clasi_name1+
"','" +@s1+ "')";

 String query3 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query4 ="values('" +@s6+ "','" +headitem_name+ "','" +clasi_name2+
"','" +@s2+ "')";

 String query5 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query6 ="values('" +@s6+ "','" +headitem_name+ "','" +clasi_name3+
"','" +@s3+ "')";

 String query7 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query8 ="values('" +@s6+ "','" +headitem_name+ "','" +clasi_name4+
"','" +@s4+ "')";

 String query9  ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query10 ="values('" +@s6+ "','" +headitem_name+ "','" +clasi_name5+
"','" +@s5+ "')";

 end

  int rowsAffected =
stmt.executeUpdate(query1+query2+query3+query4+query5+query6+query7+query8+q
uery9+query10);

   if (rowsAffected ==1)
   {

%>

  <H1> Successful Addition of Head Item </h1>

<% }
   else
      {
%>

  <H1> Sorry , Head Item Addition has failed. </h1>

<%

      }
   cstmt1.close();
   cstmt2.close();
   stmt.close();
   con.close();

%>

</body>
</html>

Thanks in advance
Suresh

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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