读书人

WebService bool 部类没有填写 程序报

发布时间: 2013-07-09 09:50:48 作者: rapoo

WebService bool 类型没有填写 程序报错


public string GetGiftsInfo(string strOperation, string gname, string gcid, string minpoint, string maxpoint, bool isnew, bool ishot, string order, int pagesize, int pageindex)


报错内容
System.ArgumentException: 无法将 转换为 System.Boolean。
参数名: type ---> System.FormatException: 该字符串未被识别为有效的布尔值。
在 System.Boolean.Parse(String value)
在 System.String.System.IConvertible.ToBoolean(IFormatProvider provider)
在 System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
在 System.Web.Services.Protocols.ScalarFormatter.FromString(String value, Type type)
--- 内部异常堆栈跟踪的结尾 ---
在 System.Web.Services.Protocols.ScalarFormatter.FromString(String value, Type type)
在 System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
在 System.Web.Services.Protocols.HtmlFormParameterReader.Read(HttpRequest request)
在 System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
在 System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
[解决办法]
引用:
Quote: 引用:

你想企图将一个空值转换成BOOL?

我就想空的时候做下处理给默认值,怎么写


在传入参数前判断,如果是空,就传入你想要的默认值

读书人网 >Web Service

热点推荐