import java.sql.*;
public class QuestionBean
{
private Connection con = null;
private Statement stmt = null;
private ResultSet rs = null;
private String ques,option1,option2,option3,option4,answer=null;
private int ques_id,last_ques_id;
private int question_no=1,mark=0;
private String name;
public QuestionBean()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:jspex");
stmt = con.createStatement();
}
catch(Exception ex)
{
System.out.println("Exception "+ex);
}
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setQues_id(int Ques_id)
{
this.ques_id = Ques_id;
}
public int getQues_id()
{
return ((int)(Math.random()*100));
}
public void setMark(boolean ma)
{
if(ma) mark++;
}
public int getMark()
{
return mark;
}
public void setQuestion_no(int q)
{
this.question_no = q;
}
public int getQuestion_no()
{
return question_no;
}
public String getQuestion()
{
try
{
rs = stmt.executeQuery("select question_description from jsp_q where question_id="+" "+ques_id);
while(rs.next())
{
ques = rs.getString("question_description");
return ques;
}
}
catch(Exception e)
{
System.out.println("Exception "+e);
}
return ques;
}
public String getOption1()
{
try
{
rs=stmt.executeQuery("select option_one from jsp_q where question_id="+ques_id);
while(rs.next())
{
option1 = rs.getString("option_one");
return option1;
}
}
catch(Exception ex)
{
System.out.println("Exception "+ex);
}
return option1;
}
public String getOption2()
{
try
{
rs = stmt.executeQuery("select option_two from jsp_q where question_id="+ques_id);
while(rs.next())
{
option2 = rs.getString("option_two");
return option2;
}
}
catch(Exception ex)
{
System.out.println("Exception "+ex);
}
return option2;
}
public String getOption3()
{
try
{
rs= stmt.executeQuery("select option_three from jsp_q where question_id="+ques_id);
while(rs.next())
{
option3 = rs.getString("option_three");
return option3;
}
}
catch(Exception ex)
{
System.out.println("Exception "+ex);
}
return option3;
}
public String getOption4()
{
try
{
rs= stmt.executeQuery("select option_four from jsp_q where question_id="+ques_id);
while(rs.next())
{
option4 = rs.getString("option_four");
return option4;
}
}
catch(Exception ex)
{
System.out.println("Exception "+ex);
}
return option4;
}
public String getAnswer()
{
try
{
rs = stmt.executeQuery("select answer from jsp_q where question_id= "+ques_id);
while(rs.next())
{
answer = rs.getString("answer");
return answer;
}
}
catch(Exception ex)
{
System.out.println("Exceptin "+ex);
}
return answer;
}
}
Thursday, February 3, 2011
objective of the project
If a user elects to use our Invite feature to invite a friend to our site, we ask them for the friend's email address. E-Friends will automatically send the friend an email inviting them to join the site. E-Friends stores this email address for the purpose of automatically adding the respondant to the friends list of the user sending the invitation, and also to send reminders of the invitation. E-Friends does not sell these email addresses or use them to send any other communication besides invitations and invitation reminders. The friend may contact E-Friends to request the removal of this information from our database
Subscribe to:
Posts (Atom)