sing System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
string strValue = RadioButtonList1.SelectedValue.ToString().Trim();
if(strValue=="1"){
Panel1.Visible=true;
Panel2.Visible=false;
Panel3.Visible=false;
}
if (strValue == "2")
{
Panel1.Visible = false;
Panel2.Visible = true;
Panel3.Visible = false;
}
if (strValue == "3")
{
Panel1.Visible = false;
Panel2.Visible = false;
Panel3.Visible = true;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string str1 = TextBox1.Text.ToString().Trim();
string str2 = TextBox2.Text.ToString().Trim();
string sexStr = RadioButtonList1.SelectedValue.ToString().Trim();
DBConn dcon = new DBConn();
SqlConnection dbconn = dcon.DBConn1();
string insertStr = "insert into student(Sno,Sname,Ssex) values('" + str1 + "','" + str2 + "','" + sexStr + "')";
//string connStr = ConfigurationManager.AppSettings["ConnectionString"].ToString();
//SqlConnection sqlConn = new SqlConnection(connStr);
//sqlConn.Open();
SqlCommand insertComm = new SqlCommand(insertStr, dbconn);
SqlDataAdapter myAdapter = new SqlDataAdapter();
myAdapter.InsertCommand = insertComm;
myAdapter.InsertCommand.ExecuteNonQuery();
dbconn.Close();
Response.Write("<script>alert('恭喜你!添加成功!')</script>");
}
protected void Button3_Click(object sender, EventArgs e)
{
string str1 = TextBox7.Text.ToString().Trim();
string sqlStr = "delete from student where Sno='" + str1 + "'";
DBConn dcon = new DBConn();
SqlConnection dbconn = dcon.DBConn1();
SqlCommand sqlCom = new SqlCommand(sqlStr,dbconn);
sqlCom.ExecuteNonQuery();
Response.Write("<script>alert('数据删除成功!')</script>");
dbconn.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
string updateStr="update student set Sname='"+
}
}