如何不向 webMethod 提供值
我正在努力为 webService 实现一个 webMethod,它具有以下标头:
public string addDocument(string docName, int docSize, string docType, string docDestinationPath, int newArch, string archName , int parentID, int archiveID )
When newArch == 0 ->无需提供parentID 值
,但当newArch ==1 -> 时应该提供所有值
我尝试在未提供parentID 时提供默认值,
public string addDocument(string docName, int docSize, string docType, string docDestinationPath, int newArch, string archName="" , int parentID=0, int archiveID=0)
但这不起作用!
我应该怎样做才能避免此错误
“输入字符串的格式不正确。”
I'm working on implementing a webMethod for a webService which has the following header:
public string addDocument(string docName, int docSize, string docType, string docDestinationPath, int newArch, string archName , int parentID, int archiveID )
When newArch == 0 -> no need to supply parentID value
but when newArch ==1 -> all the values should be supplied
I've tried to supply a default value when parentID isn't supplied
public string addDocument(string docName, int docSize, string docType, string docDestinationPath, int newArch, string archName="" , int parentID=0, int archiveID=0)
but that didn't work !
What should I do to avoid this error
" Input string was not in a correct format."
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两种方法:
这将使调用者非常清楚他们在做什么。
Have two methods:
This will make it very clear to the caller what they are doing.