主题:未将对象引用设置到对象的实例。
《-注册部分-》
错误说明:未将对象引用设置到对象的实例。我用红色注明了错误的地方。
protected System.Web.UI.HtmlControls.HtmlInputText mail;
protected System.Web.UI.HtmlControls.HtmlInputText pasw;
protected System.Web.UI.HtmlControls.HtmlInputText pasw2;
protected System.Web.UI.HtmlControls.HtmlInputText name;
protected System.Web.UI.HtmlControls.HtmlInputText mail2;
protected System.Web.UI.HtmlControls.HtmlInputText p1;
protected System.Web.UI.HtmlControls.HtmlInputText p2;
......
private void Submit1_ServerClick(object sender, System.EventArgs e)
{
if(checknum!=cn.Value)
{
Response.Write("<script>alert('对不起,你所填的认证码不正确!')</script>");
return;
}
SqlConnection Con = new SqlConnection(data.constr);
string sql="";
sql="select id from comp where mail='"+mail.Value+"'";
if(hsjdata.datareader(sql))
{
Response.Write("<script>alert('对不起,你所填的邮件地址已经注册!')</script>");
return;
}
int sv=0;
string sex="男";
if(c1.Checked)
sv=1;
if(r2.Checked)
sex="女";
[color=800000]sql="insert into comp values ('"+mail.Value+"','"+pasw.Value+"','"+name.Value+"','"+sex+"','"+p1.Value+"','"+p2.Value+"','"+p3.Value+"','"+f1.Value+"','"+f2.Value+"','"+f3.Value+"','"+mobile.Value+"','"+qq.Value+"','"+pro.Value+"','"+job.Value+"',"+sv+",'"+DateTime.Now.ToString()+"','"+post.Value+"')";[/color]
hsjdata.moddata(sql);
Session["mail"]=mail.Value;
Session["pasw"]=pasw.Value;
Response.Redirect("regok.aspx");
}
错误说明:未将对象引用设置到对象的实例。我用红色注明了错误的地方。
protected System.Web.UI.HtmlControls.HtmlInputText mail;
protected System.Web.UI.HtmlControls.HtmlInputText pasw;
protected System.Web.UI.HtmlControls.HtmlInputText pasw2;
protected System.Web.UI.HtmlControls.HtmlInputText name;
protected System.Web.UI.HtmlControls.HtmlInputText mail2;
protected System.Web.UI.HtmlControls.HtmlInputText p1;
protected System.Web.UI.HtmlControls.HtmlInputText p2;
......
private void Submit1_ServerClick(object sender, System.EventArgs e)
{
if(checknum!=cn.Value)
{
Response.Write("<script>alert('对不起,你所填的认证码不正确!')</script>");
return;
}
SqlConnection Con = new SqlConnection(data.constr);
string sql="";
sql="select id from comp where mail='"+mail.Value+"'";
if(hsjdata.datareader(sql))
{
Response.Write("<script>alert('对不起,你所填的邮件地址已经注册!')</script>");
return;
}
int sv=0;
string sex="男";
if(c1.Checked)
sv=1;
if(r2.Checked)
sex="女";
[color=800000]sql="insert into comp values ('"+mail.Value+"','"+pasw.Value+"','"+name.Value+"','"+sex+"','"+p1.Value+"','"+p2.Value+"','"+p3.Value+"','"+f1.Value+"','"+f2.Value+"','"+f3.Value+"','"+mobile.Value+"','"+qq.Value+"','"+pro.Value+"','"+job.Value+"',"+sv+",'"+DateTime.Now.ToString()+"','"+post.Value+"')";[/color]
hsjdata.moddata(sql);
Session["mail"]=mail.Value;
Session["pasw"]=pasw.Value;
Response.Redirect("regok.aspx");
}