Label3.Visible=false; } } }
protected void Button2_Click(object sender,EventArgs e) {
txtStuID.Text=\; txtStuName.Text=\; txtStuPwd.Text=\; txtStuFPwd.Text=\; txtQuePwd.Text=\; txtAnsPwd.Text=\; txtStuID.Focus(); }
protected void Button3_Click(object sender,EventArgs e) {
Response.Redirect(\); }
protected void Button1_ Click(object sender,EventArgs e) {
//µ÷Óù«¹²ÀàÖеÄeccom,Ö´ÐÐSQLÓï¾äÃüÁî dataconn.eccom(\
tb_student+\(ID.namespace,PWD,question,answer,Sex,profession)\values(\,\,\t+\,\,\,\addProfession.SelectedValue)+\)\
//Èç¹ûÌí¼Ó³É¹¦£¬µ¯³öÌí¼Ó³É¹¦¶Ô»°¿ò
Label1.Visible=true; }
protected void Button1_Click1(object sender,EventArges e) {
SqlDataReader read=dataconn.ExceRead(\ID=\+this.txtStuID.Text+\); read.Read();
if(read.HashRows) {
if(this.txtStuID.Text==read[\].toString()) {
Label2.Visible=true; }
read.Close(); }}
24
6.3.3¿¼ÉúÔÚÏß¿¼ÊÔÄ£¿é
¸ÃÒ³ÃæÖп¼ÉúÊ×ÏÈÔĶÁ¿¼ÊÔ¹æÔò£¬ÔÚͬÒâ¹æÔòºó£¬Ñ¡Ôñ¿¼ÊÔÊÔÌâºÍÌ×Ìâ
´úÂëΪ£º
using System.Data.SqlClient;
public partial class QianUser_StartExamfra:System.Web.UI.Page {
Datacon dataconn=new Datacon();
static int int_row1=0;//µ¥Ñ¡ÌâºÅË÷Òý static int int_row2=0;//¶àÑ¡ÌâºÅË÷Òý static int int_row1Point=0;//µ¥Ñ¡Ìâ·ÖÊý static int int_row2Point=0;//¶àÑ¡Ìâ·ÖÊý
//****************Ò³Ãæ¼ÓÔØÊ¼þ£¬´ÓÊý¾Ý¿âÌáÈ¡ÌâÄ¿**********// protected void Page_Load(object sender,EventArgs e) {
if(!IsPostBack) {
this.getCom(1);
this.getCom(2); } }
//***********Ìá½»ÊÔ¾í***********//
protected void btnSubmit_Click(object sender,EventArgs e) {
int_row1=0;//µ¥Ñ¡ÌâºÅË÷Òý int_row2=0;//¶àÑ¡ÌâºÅË÷Òý
25
int_row1Point=0;//µ¥Ñ¡Ìâ·ÖÊý int_row2Point=0;//¶àÑ¡Ìâ·ÖÊý //try //{
Label3.Visible=Label4.Visible=Lable7.Visible=Lable8.Visible=Label9.Visible=Label10.Visible=true;
this.lblStuID.Text=Session[\].ToString();
this.lblSubject.Text=Session[\].ToString(); this.lblQuestion.Text=Session[\].ToString(); this.getCom(3); this.getCom(4);
this.lblTotal.Text=Covert.ToString(int_rowPoint+int_row2Point); dataconn.eccom(\
+\
+\lblStuID.Text+\+lblSubject.Text+\+int_row1Point+\+int_row2Point+\);
this.getCom(5);
Response.Write(\ÄúÈ·¶¨Òª½»¾íÂ𣿡¯);location='StartExamfra.aspx':\); //this.btnSubmit.Enabled=false; //}
//Response.Write(\ÄúÒѾ´ðÓ¦¹ý¸ÃÊÔ¾í¡¯£©;window.close()\ //} }
//***********Ö´ÐÐÓëÊý¾Ý¿âµÄ¹ØÁª²Ù×÷*****// protected void getCom(int i) {
string ddl=Application[\].ToString(); string dd2=Application[\].ToString(); SqlConnection con=dataconn.getcon(); switch(i) {
//´ÓÊý¾Ý¿âÖÐÑ¡Ôñµ¥Ñ¡Ìâ case 1;
SqlDataAdapter myaddapter1=new SqlDataAdapter(\+
\µ¥Ñ¡Ìâ'and que_lessonid=\+ddl+\,con); DataSet myds1=new DateSet();
26
myaddapter1.Fill(mydsl); DataLis1.DataSource DataList.DataBind(); //Éú³Éµ¥Ñ¡ÌâÌâºÅ
for(int tID1=1;tID1<=DataList1.Item.Count;tID1++) {
Label lblSelect=(Label)DataList.Items[tID1++£©{
Label
lblSelect=(Label)DataList1.Items[tID1].FindControl(\); lblSelect.Text=tID1.ToString()+\¡¢\; }
break;
//´ÓÊý¾Ý¿âÖÐÑ¡Ôñ¶àÑ¡Ìâ case 2£º
SqlDataAdapter myadapter2=new SqlDataAdapter(\
+\tb_Questions where que_type='¶àÑ¡Ìâ'and que_lessonid=\
+ddl+\and que_taotiid=\order by id desc\
DataSet myds2=new DataSet(); myadapter2.Fill(myds2); DataList2.DataSource=myds2; DataList2.DataBind(); //Éú³É¶àÑ¡ÌâÌâºÅ for(int
tID2=1;tID2<=DataList2.Items.Count;tID2++) {
Label
lblDselect=(Label)DataList2.Items[tID2-1].FindControl(\); lblDselect.Text=tID2.ToString()+\¡¢\; }
break;
//ºË¶Ôµ¥Ñ¡Ìâ case 3:
SqlDataAdapter myadapter3=new SqlDataAdapter(\
+\µ¥Ñ¡Ìâ'and que_lessonid=\
+ddl+\+dd2+\desc\,con);
DataSet myds3=new DataSet(); myadapter3.Fill(myds3);
27