using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;public partial class StudentInfo : System.Web.UI.Page
{
public string ClassName;
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Button2_Click(object sender, EventArgs e)
{
string name;
string password;
string No;
string ClassName;
int Num = int.Parse(Session["Num"].ToString());
for (int j = 1; j <= Num; j++)
{
name = Request["name" + j].ToString();
password = Request["pwd" + j].ToString();
No = Request["No" + j].ToString();
ClassName = Request["classname" + j].ToString();
string sql = "insert into student(studentname,studentpassword,studentclass,studentorder)";
sql += "values('"+name+"','"+password+"','"+ClassName+"','"+No+"')";
DataConn d1 = new DataConn();
d1.conn.Open();
SqlCommand cmd = new SqlCommand(sql, d1.conn);
cmd.ExecuteNonQuery();
d1.conn.Close();
}
this.Panel2.Visible = true;
this.TextBox1.Text = "";
this.TextBox2.Text = "";
this.TextBox3.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
this.ClassName = this.TextBox1.Text;
this.StuNum = int.Parse(this.TextBox3.Text);
Session["Num"] = StuNum;
No = new string[StuNum];
for (int i = 1; i <= StuNum; i++)
{
if (i < 10)
No[i - 1] = ClassName + "0" + i;
else
No[i - 1] = ClassName + i;
}
Panel2.Visible = false;
Panel1.Visible = true;
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedValue == "0")
{
Panel2.Visible = true;
Panel3.Visible = false;
}
else
{
Panel3.Visible = true;
Panel2.Visible = false;
Panel1.Visible = false;
}
}
}错误:"ASP.studentinfo_aspx"并不包含“panel2_load”的定义
“studentinfo”并不包含“StuNum”的定义
当前上下文中不存在名称“No”
当前上下文中不存在名称“StuNum”
using System.Data;
using System.Configuration;
using System.Collections;
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;public partial class StudentInfo : System.Web.UI.Page
{
public string ClassName;
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Button2_Click(object sender, EventArgs e)
{
string name;
string password;
string No;
string ClassName;
int Num = int.Parse(Session["Num"].ToString());
for (int j = 1; j <= Num; j++)
{
name = Request["name" + j].ToString();
password = Request["pwd" + j].ToString();
No = Request["No" + j].ToString();
ClassName = Request["classname" + j].ToString();
string sql = "insert into student(studentname,studentpassword,studentclass,studentorder)";
sql += "values('"+name+"','"+password+"','"+ClassName+"','"+No+"')";
DataConn d1 = new DataConn();
d1.conn.Open();
SqlCommand cmd = new SqlCommand(sql, d1.conn);
cmd.ExecuteNonQuery();
d1.conn.Close();
}
this.Panel2.Visible = true;
this.TextBox1.Text = "";
this.TextBox2.Text = "";
this.TextBox3.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
this.ClassName = this.TextBox1.Text;
this.StuNum = int.Parse(this.TextBox3.Text);
Session["Num"] = StuNum;
No = new string[StuNum];
for (int i = 1; i <= StuNum; i++)
{
if (i < 10)
No[i - 1] = ClassName + "0" + i;
else
No[i - 1] = ClassName + i;
}
Panel2.Visible = false;
Panel1.Visible = true;
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedValue == "0")
{
Panel2.Visible = true;
Panel3.Visible = false;
}
else
{
Panel3.Visible = true;
Panel2.Visible = false;
Panel1.Visible = false;
}
}
}错误:"ASP.studentinfo_aspx"并不包含“panel2_load”的定义
“studentinfo”并不包含“StuNum”的定义
当前上下文中不存在名称“No”
当前上下文中不存在名称“StuNum”
解决方案 »
- vb.net 中的HandlesC#如何实现
- 最近有一个疑惑是关于 String 与 StringBuilder 的
- 如何让Rational Rose支持C#建模?
- ViewState问题
- 农历转换阴历的源代码(急急急急急!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
- 点按钮 表格就显示出来,这里哪有错,帮我改改
- 怎样获取下载的文件名?
- 如何打开一个无菜单工具栏的IE窗口
- 单击按钮获取的DropDownList选中值老是一样
- 我想自己建个小说下载网站,哪里有源代码下载!!
- 在做注册页面功能时,点击验证密码按钮后。两个密码文本框就清空了!!!!怎么办????
- 关于初学ASP.NET的的一点心得
StuNum 你没有声明
StuNum没有定义