| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1732 人关注过本帖
标题:为什么我在添加信息时,会出现这样个错误:发生类型为System.Web.HttpUnhan ...
只看楼主 加入收藏
水晶之恋
Rank: 1
等 级:新手上路
帖 子:70
专家分:0
注 册:2007-4-23
收藏
 问题点数:0 回复次数:11 
为什么我在添加信息时,会出现这样个错误:发生类型为System.Web.HttpUnhandledExc
为什么我在添加信息时,会出现这样个错误:
发生类型为System.Web.HttpUnhandledException的异常
搜索更多相关主题的帖子: System Web 类型 
2007-05-17 09:10
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
收藏
得分:0 
把相关的代码发出来吧...这样谁也不知道是什么错..

飘过~~
2007-05-17 09:21
水晶之恋
Rank: 1
等 级:新手上路
帖 子:70
专家分:0
注 册:2007-4-23
收藏
得分:0 
private void add_Click(object sender, System.EventArgs e)
{ strsql="insert into users(username,sex,hometown,nation,birth,health,marry,political,address,mobilephone,homephone,email,gra_school,zhuanye,xueli,gra_time,work_time,dep_name,zhiwu,type,constract_time,cancel_time,PicUrl) values ( ";

strsql+="'" + username.Text + "'";
strsql+="'" + sex.SelectedValue + "'";
strsql+="'" + hometown.Text + "'";
strsql+="'" + nation.Text + "'";
strsql+="'" + birth.Text + "'";
strsql+="'" + health.Text + "'";
strsql+="'" + marry.SelectedValue + "'";
strsql+="'" + political.Text + "'";
strsql+="'" + address.Text + "'";
strsql+="'" + mobilephone.Text + "'";
strsql+="'" + homephone.Text + "'";
strsql+="'" + email.Text + "'";
strsql+="'" + gra_school.Text + "'";
strsql+="'" + zhuanye.Text + "'";
strsql+="'" + xueli.SelectedValue + "'";
strsql+="'" + gra_time.Text + "'";
strsql+="'" + work_time.Text + "'";
strsql+="'" + dep_name.SelectedValue + "'";
strsql+="'" + zhiwu.Text + "'";
strsql+="'" + type.SelectedValue + "'";
strsql+="'" + constract_time.Text + "'";
strsql+="'" + cancel_time.Text + "'";
strsql+=url;
strsql+=")";

com=new SqlCommand(strsql,conn);
conn.Open();
com.ExecuteNonQuery();
com.Dispose();
conn.Close();
Response.Write("<script>javascript:alert('添加成功!!!');</script>");
// Response.Redirect("add_person.aspx?users_id=");
}
2007-05-17 09:29
冰镇柠檬汁儿
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:北京
等 级:版主
威 望:120
帖 子:8078
专家分:6657
注 册:2005-11-7
收藏
得分:0 

.NET Framework 类库
HttpUnhandledException 类
发生一般异常时引发的异常。

命名空间:System.Web
程序集:System.Web(在 system.web.dll 中)

语法

Visual Basic(声明)
<SerializableAttribute> _
Public NotInheritable Class HttpUnhandledException
Inherits HttpException

Visual Basic(用法)
Dim instance As HttpUnhandledException

C#
[SerializableAttribute]
public sealed class HttpUnhandledException : HttpException

C++
[SerializableAttribute]
public ref class HttpUnhandledException sealed : public HttpException

J#
/** @attribute SerializableAttribute() */
public final class HttpUnhandledException extends HttpException

JScript
SerializableAttribute
public final class HttpUnhandledException extends HttpException

继承层次结构

System.Object
System.Exception
System.SystemException
System.Runtime.InteropServices.ExternalException
System.Web.HttpException
System.Web.HttpUnhandledException

线程安全

此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。
平台

Windows 98、Windows 2000 SP4、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。

版本信息

.NET Framework
受以下版本支持:2.0、1.1、1.0


本来无一物,何处惹尘埃
It is empty at all here, Why pm 2.5 is so TMD high!
2007-05-17 09:35
冰镇柠檬汁儿
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:北京
等 级:版主
威 望:120
帖 子:8078
专家分:6657
注 册:2005-11-7
收藏
得分:0 
楼主啊,你values里的值之间怎么没有“,”

本来无一物,何处惹尘埃
It is empty at all here, Why pm 2.5 is so TMD high!
2007-05-17 09:37
Kendy123456
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:62
帖 子:2720
专家分:0
注 册:2007-1-3
收藏
得分:0 
错是这个错 但是报出来应该是sql异常呀 为什么报了个无法标识的异常呢

2007-05-17 09:46
水晶之恋
Rank: 1
等 级:新手上路
帖 子:70
专家分:0
注 册:2007-4-23
收藏
得分:0 
private void add_Click(object sender, System.EventArgs e)
{
try
{
string strsql;

strsql="insert into users(username,sex,hometown,nation,birth,health,marry,political,address,mobilephone,homephone,email,gra_school,zhuanye,xueli,gra_time,work_time,dep_name,zhiwu,type,constract_time,cancel_time,PicUrl)";
strsql+=" + values( +";

strsql+="'" + username.Text + "'";
strsql+="'" + sex.SelectedValue + "'";
strsql+="'" + hometown.Text + "'";
strsql+="'" + nation.Text + "'";
strsql+="'" + birth.Text + "'";
strsql+="'" + health.Text + "'";
strsql+="'" + marry.SelectedValue + "'";
strsql+="'" + political.Text + "'";
strsql+="'" + address.Text + "'";
strsql+="'" + mobilephone.Text + "'";
strsql+="'" + homephone.Text + "'";
strsql+="'" + email.Text + "'";
strsql+="'" + gra_school.Text + "'";
strsql+="'" + zhuanye.Text + "'";
strsql+="'" + xueli.SelectedValue + "'";
strsql+="'" + gra_time.Text + "'";
strsql+="'" + work_time.Text + "'";
strsql+="'" + dep_name.SelectedValue + "'";
strsql+="'" + zhiwu.Text + "'";
strsql+="'" + type.SelectedValue + "'";
strsql+="'" + constract_time.Text + "'";
strsql+="'" + cancel_time.Text + "'";
strsql+="'" + url + "'";
strsql+=")";
com=new SqlCommand(strsql,conn);
conn.Open();
com.ExecuteNonQuery();

Response.Write("<script>javascript:alert('添加成功!!!');</script>");
Response.Redirect("default.aspx");
}
catch(Exception ee)
{
Response.Write("出现异常错误!");
throw ee;
}

}
com.Dispose();
conn.Close();
}
2007-05-17 09:56
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
收藏
得分:0 
就是SQL的错误,你加了TRY..CATCH..说的是什么错?

飘过~~
2007-05-17 10:30
水晶之恋
Rank: 1
等 级:新手上路
帖 子:70
专家分:0
注 册:2007-4-23
收藏
得分:0 

我加入信息后,就是那个错
sql语句是不是应该改成:

strsql="insert into users(username,sex,hometown,nation,birth,health,marry,political,address,mobilephone,homephone,email,gra_school,zhuanye,xueli,gra_time,work_time,dep_name,zhiwu,type,constract_time,cancel_time,PicUrl)";
strsql+=" + values( +";

strsql+="'" + username.Text + "'";
strsql+=","; //是不是都加入这句
strsql+="'" + sex.SelectedValue + "'";
strsql+="'" + hometown.Text + "'";
strsql+="'" + nation.Text + "'";
strsql+="'" + birth.Text + "'";
strsql+="'" + health.Text + "'";
strsql+="'" + marry.SelectedValue + "'";
strsql+="'" + political.Text + "'";
strsql+="'" + address.Text + "'";

2007-05-17 10:41
fqbnet2008
Rank: 2
等 级:新手上路
威 望:4
帖 子:1020
专家分:0
注 册:2007-1-4
收藏
得分:0 
strsql+="'" + username.Text + "'";
strsql+="'" + sex.SelectedValue + "'";

你这么写是不是清楚一些呢?
strsql+="'" + username.Text + "',' ";
strsql+= sex.SelectedValue + "',' ";
........
strsql+= username.Text + "',' ";
strsql+= sex.SelectedValue + "') ";

最后别忘了加小括号。


雄关漫道真如铁,而今迈步从头越,从头越,苍山如海,残阳如血㊣♀★
2007-05-17 10:43
快速回复:为什么我在添加信息时,会出现这样个错误:发生类型为System.Web.Http ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017345 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved