Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: How do I define a Nullable DateTime variable in Visual COBOL ?

$
0
0

I can't use the above code because I'm not coding embedded SQL.

I'm using the npgsql .NET data provider that comes with Postgresql.  Npgsql.dll includes a Parameters class for passing values to Postgresql.

        01  Closed_Month              type DateTime.  

I need to be able to set Closed_Month to a null value when closed month is blank in my data.

I add a parameter to the Parameters class and indicate its Postgresql data type:

("value5" is from my SQL INSERT string and it  represents the closed month column in the database table)

          invoke command::Parameters::Add(new type NpgsqlParameter("value5", type NpgsqlTypes.NpgsqlDbType::Timestamp)).

Then I assign my COBOL variable to it:

          set command::Parameters[4]::Value to Closed_Month.

I need to use a Visual COBOL variable that is like "DateTime?    Closed_Month" in C#, one that will accept a null value without converting it to the first date of the Gregorian calendar.

Is there a way to declare a nullable type in Visual COBOL ?


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>