简体   繁体   中英

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

I'm translating some code written in C# to Java. This code uses COM objects to interact with a third party application. 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.

How can I handle it from a Java application?

.NET System.DBNull is equivalent to a VARIANT of type VT_NULL . In fact this is documented officially here: DBNull Class

So I suppose using com4j you can create a Variant , call setType (VT_NULL), and pass this to the .NET interop layer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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