在 VB.Net 中使用 Null

发布于 2024-12-20 05:41:05 字数 171 浏览 1 评论 0原文

我正在从 HP 质量中心调用 OTA API,其中一个调用需要发送 NULL。

这是实际的代码行:

stepF.AddItem(NULL)

这在 VBA 和 VB6 中完美运行,但 VB.NET 不接受 Null。有人知道如何解决这样的问题吗?

I am calling the OTA API from HP Quality Centre and one of the calls requires sending a NULL.

This is the actual line of code:

stepF.AddItem(NULL)

This works perfectly in VBA and VB6 but VB.NET doesn't accept Nulls. Anyone know how to fix such an issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

弥枳 2024-12-27 05:41:05

您需要使用 Nothing,它是 大部分等效null

You need to use Nothing, which is mostly equivalent to null.

猫七 2024-12-27 05:41:05

Nothing 是 VB.Net 中大多数引用类型的 Null 值,我建议您查看 MSDN这篇文章,如果您使用的 API 是 .Net Web 服务,您可以能够对 WSDL 进行部分分类并进行修复,尽管听起来好像您不是。

Nothing is the Null value for most reference types in VB.Net, I would recommend taking a look at Nullable(Of T) on either MSDN or some good information about it in this SO post, if the API you are using is a .Net web service you may be able to partial class the WSDL and fix although it sounds as though you are not.

可爱暴击 2024-12-27 05:41:05

正确使用的值是System.DBNull.Value

即使文档告诉我们这通常用于数据库空值,它也代表没有值,否则NULL

The correct value to use is System.DBNull.Value.

Even if the documentation tells us that this is generally used for database null values, it represent the absence of value, otherwise NULL.

愿与i 2024-12-27 05:41:05

您应该使用 DBNull

You should use DBNull

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文