<%@ page language = "java" import = "java.sql.*" %>
<%@ page import = "java.sql.*" %>
<%@ page import = "java.text.*" %>
<%
String username,passw,passw1,compnam,tinn;
username= request.getParameter("username");
passw = request.getParameter("pwd");
passw1 = request.getParameter("pwd1");
compnam = request.getParameter("compname");
tinn=request.getParameter("TIN");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String st = "jdbc:odbc:loginval";
Connection cn = DriverManager.getConnection(st," "," ");
Statement stmt = cn.createStatement();
String sql = "insert into register " ;
sql +="(username,pwd,pwd1,compname,TIN)";
sql += " values ('";
sql += username ;
sql += "','";
sql += passw;
sql += "','";
sql += passw1;
sql += "','" ;
sql += compnam ;
sql += "','" ;
sql += tinn;
sql += "')";
int val = stmt.executeUpdate(sql);
cn.close();
if(val==1)
{
%>
<jsp:forward page = "success.html"/>
<%
}
%>
-----------------------------------------------------------------------------------------------
this is my code, i am not able to insert any values in to my table thru this code, when i submit for the first time null values are stored in the table i mean "null" is getting displayed in the table.
when i submit for the second time then the server throws an error "general error"
some one help me plz
thanks in advance