Hi Friends,
I'm facing a serius problem...in 2 days i have to submit my project and i'm stuck here..please help me...
I'm getting some values from the database from one table say roll_no on one page....and then on that page i'm putting some values in front of that roll_no.
Now I want to store the all data in a another table..
P.S. roll no. are not fixed and that is it can any thing from 1 - 60
here is my code.
[CODE=java]
<select size="1" name="subject" style="font-family: Arial; font-size: 10px; color:#0B333C"> </select>
<--some value -->
<select size="1" name="month" style="font-family: Arial; font-size: 10px; color:#0B333C"> </select>
<--some value-->
<select size="1" name="year" style="font-family: Arial; font-size: 10px; color:#0B333C"> </select></tr>
<tr>
<td><input type="submit" value="SUBMIT" name="action"/>
<table width="800" border="4" cellpadding="1" cellspacing="1" >
<td>
<table width="800" border="2" bordercolor="#F FFFFF" cellpadding="0" cellspacing="0" >
<tr> <td align="right">
</tr>
<td>
<%! String stu_roll;%>
<%
String getsub1 = request.getPara meter("subject" );
String getmonth = request.getPara meter("month");
String getyear = request.getPara meter("year");
%>
<%
try
{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con = DriverManager.g etConnection("j dbc:odbc:lala") ;
Statement stmt = con.createState ment();
String str1 = "select roll_no from student where sem_id = (select sem_id from subject where course_id ='bsc_it' and sub_id = '"+getsub1+"')" ;
ResultSet rs = stmt.executeQue ry(str1);
%>
<table align="center" width="" cellpadding="0" cellspacing="0" border="1" cellspacing="1" cellpadding="1" >
<tr>
<td><input type="text" value="Total Lecture" readonly=""/></td>
<td><input type="text" name="total_att " maxlength="2"></td>
</tr>
<tr>
<td><input type="text" value="Student roll no." readonly="" /></td>
</tr>
<%
int no = 0;
while(rs.next() )
{
stu_roll = rs.getString("r oll_no");
no = no + 1;
%>
<tr bordercolor="#C C3366">
<td>
<input type="text" name="roll<%=no %>" value="<%= stu_roll %>" readonly=""/>
</td>
<td align="center" style="color:#0 052A4 ">:</td>
<td>
<input type="text" name="att<%=no %>" />
<input type="hidden" name="no" value="<%=no %>" />
</td>
</tr>
<%
}
%>
[/CODE]
second page from where i'm inserting.
[CODE=java]
<%!
int no1 = request.getPara meter("no");
int i;
%>
<%
for(i=1;i<no1;i ++)
{
%>
<%
String getsub1 = request.getPara meter("subject" );
String getmonth = request.getPara meter("month");
String getyear = request.getPara meter("year");
String getatt = request.getPara meter("att"+i);
String stu_roll = request.getPara meter("roll"+i) ;
%>
<%
try
{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con = DriverManager.g etConnection("j dbc:odbc:lala") ;
PreparedStateme nt ps=con.prepareS tatement("inser t into attendance values(?,?,?,?, ?,?)");
ps.setString(1, stu_roll);
ps.setString(2, getsub1);
ps.setString(3, getmonth);
ps.setString(4, getyear);
ps.setString(5, getatt);
ps.setString(6, "10");
ps.executeUpdat e();
%>
[/CODE]
please help me......
I'm facing a serius problem...in 2 days i have to submit my project and i'm stuck here..please help me...
I'm getting some values from the database from one table say roll_no on one page....and then on that page i'm putting some values in front of that roll_no.
Now I want to store the all data in a another table..
P.S. roll no. are not fixed and that is it can any thing from 1 - 60
here is my code.
[CODE=java]
<select size="1" name="subject" style="font-family: Arial; font-size: 10px; color:#0B333C"> </select>
<--some value -->
<select size="1" name="month" style="font-family: Arial; font-size: 10px; color:#0B333C"> </select>
<--some value-->
<select size="1" name="year" style="font-family: Arial; font-size: 10px; color:#0B333C"> </select></tr>
<tr>
<td><input type="submit" value="SUBMIT" name="action"/>
<table width="800" border="4" cellpadding="1" cellspacing="1" >
<td>
<table width="800" border="2" bordercolor="#F FFFFF" cellpadding="0" cellspacing="0" >
<tr> <td align="right">
</tr>
<td>
<%! String stu_roll;%>
<%
String getsub1 = request.getPara meter("subject" );
String getmonth = request.getPara meter("month");
String getyear = request.getPara meter("year");
%>
<%
try
{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con = DriverManager.g etConnection("j dbc:odbc:lala") ;
Statement stmt = con.createState ment();
String str1 = "select roll_no from student where sem_id = (select sem_id from subject where course_id ='bsc_it' and sub_id = '"+getsub1+"')" ;
ResultSet rs = stmt.executeQue ry(str1);
%>
<table align="center" width="" cellpadding="0" cellspacing="0" border="1" cellspacing="1" cellpadding="1" >
<tr>
<td><input type="text" value="Total Lecture" readonly=""/></td>
<td><input type="text" name="total_att " maxlength="2"></td>
</tr>
<tr>
<td><input type="text" value="Student roll no." readonly="" /></td>
</tr>
<%
int no = 0;
while(rs.next() )
{
stu_roll = rs.getString("r oll_no");
no = no + 1;
%>
<tr bordercolor="#C C3366">
<td>
<input type="text" name="roll<%=no %>" value="<%= stu_roll %>" readonly=""/>
</td>
<td align="center" style="color:#0 052A4 ">:</td>
<td>
<input type="text" name="att<%=no %>" />
<input type="hidden" name="no" value="<%=no %>" />
</td>
</tr>
<%
}
%>
[/CODE]
second page from where i'm inserting.
[CODE=java]
<%!
int no1 = request.getPara meter("no");
int i;
%>
<%
for(i=1;i<no1;i ++)
{
%>
<%
String getsub1 = request.getPara meter("subject" );
String getmonth = request.getPara meter("month");
String getyear = request.getPara meter("year");
String getatt = request.getPara meter("att"+i);
String stu_roll = request.getPara meter("roll"+i) ;
%>
<%
try
{
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
Connection con = DriverManager.g etConnection("j dbc:odbc:lala") ;
PreparedStateme nt ps=con.prepareS tatement("inser t into attendance values(?,?,?,?, ?,?)");
ps.setString(1, stu_roll);
ps.setString(2, getsub1);
ps.setString(3, getmonth);
ps.setString(4, getyear);
ps.setString(5, getatt);
ps.setString(6, "10");
ps.executeUpdat e();
%>
[/CODE]
please help me......
Comment