.NET DateTime appears as Date in Navision

Mog
Member Posts: 34
Hi!
I wrote an automation server in C# that is used by Navision. One method takes a DateTime parameter, but this is displayed as Date in Navision. I am not able to call the method using e.g. CURRENTDATETIME as a value, the compiler starts crying that he wants a Date.
c# code
Navision code, unable to compile
Navision code, works
This sucks, as I need the whole information from CURRENTDATETIME to be passed to the automation server. Does anyone have an idea what I did wrong?
regards
Mog
I wrote an automation server in C# that is used by Navision. One method takes a DateTime parameter, but this is displayed as Date in Navision. I am not able to call the method using e.g. CURRENTDATETIME as a value, the compiler starts crying that he wants a Date.
c# code
public class whatever{ // ... public void AddDateTime(DateTime value){ }
Navision code, unable to compile
create(whatever); whatever.AddDateTime(CURRENTDATETIME)
Navision code, works
create(whatever); whatever.AddDateTime(TODAY)
This sucks, as I need the whole information from CURRENTDATETIME to be passed to the automation server. Does anyone have an idea what I did wrong?
regards
Mog
0
Comments
-
The types seem get wrongly mapped.
If the automation object is only used by navision you could try a workaround either by passing date and time separately or passing the value as a text string.
Good luck.
Thomas0 -
thanks, I think I will just hand over a string, but this is really bad0
-
Hi,
COMs doesn't support DateTime variables, but does support Variant. The solution below should work.
c# codepublic class whatever{ // ... public void AddDateTime(System.Object value){ Datetime dt = DateTime.Parse(value); // ... }
C/Side code// varDateTime - datatype Variant // dteDateTime - datatype DateTime varDateTime := dteDateTime; whatever.AddDateTime(varDateTime);
Good luck!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions