简体   繁体   English

如何在Java中使用C#System.DBNull.value?

[英]How can I make use of C# System.DBNull.value in Java?

I'm translating some code written in C# to Java. 我正在将一些用C#编写的代码翻译成Java。 This code uses COM objects to interact with a third party application. 此代码使用COM对象与第三方应用程序进行交互。 I managed to handle COM objects using com4j library, but one of the methods requires System.DBNull.value to be passed into it which is a C# object. 我设法使用com4j库处理COM对象,但是其中一种方法要求将System.DBNull.value传递给它,它是一个C#对象。

How can I handle it from a Java application? 如何从Java应用程序处理它?

.NET System.DBNull is equivalent to a VARIANT of type VT_NULL . .NET System.DBNull等效于VT_NULL类型的VARIANT In fact this is documented officially here: DBNull Class 实际上,这是正式记录在这里: DBNull类

So I suppose using com4j you can create a Variant , call setType (VT_NULL), and pass this to the .NET interop layer. 因此,我想使用com4j可以创建Variant ,调用setType (VT_NULL),并将其传递到.NET互操作层。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM