thanks everyone..
bt the problem still remains.
.. i made changes to the insert stmt..
bt ..
in this page i have 3 textfields .. paper_title,authors, year, citation..
whatever value i give in the paper_title .. it gives an error in the same..
if i give "one" as the value..
it shows the error as
:
the value of paper_title
ne
the value of co is:two
the value of citation is:three
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: In
correct syntax near 'one'.
here's the code again:
<%@ page language="java" import="java.sql.*,java.io.*" %>
<%
Connection con=null;
java.sql.Statement stmt=null;
String paper_title="";
String co_authors="";
int year=0;
String citation="";
String username="";the value of paper is
ne
String xy=(String)session.getAttribute("y");
if(xy==null)
xy="jasu";
paper_title=request.getParameter("paper_title");
co_authors=request.getParameter("co_authors");
year=Integer.parseInt(request.getParameter("year"));
citation=request.getParameter("citation");
out.println(username);
System.out.println("the value of paper is:"+paper_title);
System.out.println("the value of co is:"+co_authors);
System.out.println("the value of citation is:"+citation);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc
dbc:mech_iit");
stmt=con.createStatement();
out.println("insert into Papers(user_login,paper_title,co_authors,year,citation) values('"+xy+"'"+paper_title+"','"+co_authors+"',"+year+",'"+citation+"')");
int i=stmt.executeUpdate("insert into Papers(user_login,paper_title,co_authors,year,citation) values('"+xy+"'"+paper_title+"','"+co_authors+"',"+year+",'"+citation+"')");
System.out.println("the value of:" +i);
stmt.close();
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
%>