捕获异常描述 [英] Catch Exception Descrition

查看:64
本文介绍了捕获异常描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试从网格中删除一条记录时遇到以下错误.
任何人都可以告诉我该异常的含义.在此先感谢.
将nvarchar值"29g"转换为数据类型int时转换失败"

在我的代码中,以下情况

Hi I am getting the following error while am trying to delete one record from my Grid.
Can anybody tell me what the exception mean.Thanx in advance..
"Conversion failed when converting the nvarchar value ''29g'' to data type int"

In my code its the following case

else if (type == "DelDoctor")
     {
         objuserVO.DoctorID = Convert.ToInt32(Session["DoctorID"]);
         objuserVO.Transtype = "DEL";
         objRequestVO.addobject("AddDoctorsProfile", objuserVO);
     }

推荐答案

您显示的代码与您的问题无关.

像错误一样,"29g"无法转换为整数值.检查您输入的数据,并删除数据库中所有行的"g"或不是数字的任何内容.

将验证添加到数据条目中以检查非整数值,这样就不会发生.
The code you are showing is not related to your problem.

Like the error says "29g" cannot be converted to an integer value. Check the data you have entered and remove the "g" or anything which is not an number for all the rows in your database.

Add validation to your data entry to check for non integer values so this does not happen.


错误消息allready已经说明了一切.您不能将字符"29g"转换为整数表示.当然29g不是数字.或者你能告诉我结果是什么:(29g + gst)* 5 =吗?"
The error message allready says it all. You can not convert the characters ''29g'' to an integer representation. Of course 29g is not a number. Or can you tell me what would be the result of: "(29g + gst) * 5 = ?"


您的Session ["DoctorID"]包含"29g".
您正在将该值转换为int.
您不能将"29g"转换为整数.
通常,id字段应为int.如果您将id字段用作nvarchar,则不是将session转换为int而是转换为字符串.
Your Session["DoctorID"] contains "29g".
You are converting this value to int.
You cant convert "29g" to integer.
Normally Id fiel should be int. If you have used id field as nvarchar then rather than converting session to int convert to string.


这篇关于捕获异常描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆