Student Information
Enter Student Details:
Student Information
<%@ page import="java.sql.*,java.util.*"%>
STUDENT INFORMATION IS STORED SUCCESSFULLY
<%
String sname=request.getParameter("sname");
String regno=request.getParameter("regno");
String course=request.getParameter("course");
String college=request.getParameter("college");
String city=request.getParameter("city");
String phone=request.getParameter("phone");
out.print(" ");
out.println("ID "+regno+" ");
out.println("NAME "+sname+" ");
out.println("college "+college+" ");
out.println("course "+course+" ");
out.print("
");
try
{
int len=phone.length();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:db2");
Statement st=con.createStatement();
if(len==10)
{
try
{
out.println("Data Successfully inserted.");
String s="insert into Table1 values('"+regno+"','"+sname+"','"+course+"','"+college+"','"+city+"','"+phone+"');";
st.executeQuery(s);
}
catch(Exception e){}
}
else
out.println("invalid phone number!!!!!!");
}
catch(Exception e)
{
out.println(e);
}
%>