C#这个代码怎么定义类?要具体的
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSys...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using System.Data;
using System.Data.SqlClient;
namespace EMsystem.WebManager
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["userName"] == null)
{
Response.Redirect("../Login.aspx");
}
if (!IsPostBack)
{
SqlConnection conn = BaseClass.DBCon();
conn.Open();
SqlCommand cmd = new SqlCommand("select * from tb_Lesson", conn);
SqlDataReader sdr = cmd.ExecuteReader();
this.ddlkm.DataSource = sdr;
this.ddlkm.DataTextField = "LessonName";
this.ddlkm.DataValueField = "ID";
this.ddlkm.DataBind();
this.ddlkm.SelectedIndex = 0;
conn.Close();
}
}
protected void btnconfirm_Click(object sender, EventArgs e)
{
if (txtsubject.Text == "" || txtAnsA.Text == "" || txtAnsB.Text == "" || txtAnsC.Text == "" || txtAnsD.Text == "")
{
MessageBox.Show("请将信息填写完整");
return;
}
else
{
string isfb = "";
if (cbFB.Checked == true)
isfb = "1";
else
isfb = "0";
string str = "insert into tb_test(testContent,testAns1,testAns2,testAns3,testAns4,rightAns,pub,testCourse,class) values('" + txtsubject.Text.Trim() + "','" + txtAnsA.Text.Trim() + "','" + txtAnsB.Text.Trim() + "','" + txtAnsC.Text.Trim() + "','" + txtAnsD.Text.Trim() + "','" + rblRightAns.SelectedValue.ToString() + "','" + isfb + "','" + ddlkm.SelectedItem.Text + "','单选题')";
BaseClass.OperateData(str);
btnconcel_Click(sender, e);
}
}
protected void btnconcel_Click(object sender, EventArgs e)
{
txtsubject.Text = "";
txtAnsD.Text = "";
txtAnsC.Text = "";
txtAnsB.Text = "";
txtAnsA.Text = "";
} 展开
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using System.Data;
using System.Data.SqlClient;
namespace EMsystem.WebManager
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["userName"] == null)
{
Response.Redirect("../Login.aspx");
}
if (!IsPostBack)
{
SqlConnection conn = BaseClass.DBCon();
conn.Open();
SqlCommand cmd = new SqlCommand("select * from tb_Lesson", conn);
SqlDataReader sdr = cmd.ExecuteReader();
this.ddlkm.DataSource = sdr;
this.ddlkm.DataTextField = "LessonName";
this.ddlkm.DataValueField = "ID";
this.ddlkm.DataBind();
this.ddlkm.SelectedIndex = 0;
conn.Close();
}
}
protected void btnconfirm_Click(object sender, EventArgs e)
{
if (txtsubject.Text == "" || txtAnsA.Text == "" || txtAnsB.Text == "" || txtAnsC.Text == "" || txtAnsD.Text == "")
{
MessageBox.Show("请将信息填写完整");
return;
}
else
{
string isfb = "";
if (cbFB.Checked == true)
isfb = "1";
else
isfb = "0";
string str = "insert into tb_test(testContent,testAns1,testAns2,testAns3,testAns4,rightAns,pub,testCourse,class) values('" + txtsubject.Text.Trim() + "','" + txtAnsA.Text.Trim() + "','" + txtAnsB.Text.Trim() + "','" + txtAnsC.Text.Trim() + "','" + txtAnsD.Text.Trim() + "','" + rblRightAns.SelectedValue.ToString() + "','" + isfb + "','" + ddlkm.SelectedItem.Text + "','单选题')";
BaseClass.OperateData(str);
btnconcel_Click(sender, e);
}
}
protected void btnconcel_Click(object sender, EventArgs e)
{
txtsubject.Text = "";
txtAnsD.Text = "";
txtAnsC.Text = "";
txtAnsB.Text = "";
txtAnsA.Text = "";
} 展开
1个回答
展开全部
http://www.360doc.com/content/13/0207/08/19147_264646769.shtml
仔细去看看吧,都是很基础的内容。
仔细去看看吧,都是很基础的内容。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询