Issue in passing a String from NAV to a DotNet Method

fazlehasan
Member Posts: 70
I was trying to pass a text variable txtStartDate from NAV2017
to a DotNet Method: SomeMethod(String StartDate)
I found that when I pass a value directly to the DotNet Method like this (1) SomeMethod('2022-02-25T13:30:00')
it behaves differently than when I pass (2) SomeMethod(txtStartDate) [although I have assigned txtStartDate:='2022-02-25T13:30:00'];
For me DotNot Method works correctly in case of (1),
but DotNot Method doesn't work correctly in case of (2).
Is there something different between txtStartDate and '2022-02-25T13:30:00',
when I have already assigned '2022-02-25T13:30:00' to txtStartDate;
Is it becuase of difference between .NET datatype and NAV datatype. What do I need to do to resolve?
Do I need to do some conversion before sending to DotNet method which is expecting a String DataType?
Thank.
Fazle
to a DotNet Method: SomeMethod(String StartDate)
I found that when I pass a value directly to the DotNet Method like this (1) SomeMethod('2022-02-25T13:30:00')
it behaves differently than when I pass (2) SomeMethod(txtStartDate) [although I have assigned txtStartDate:='2022-02-25T13:30:00'];
For me DotNot Method works correctly in case of (1),
but DotNot Method doesn't work correctly in case of (2).
Is there something different between txtStartDate and '2022-02-25T13:30:00',
when I have already assigned '2022-02-25T13:30:00' to txtStartDate;
Is it becuase of difference between .NET datatype and NAV datatype. What do I need to do to resolve?
Do I need to do some conversion before sending to DotNet method which is expecting a String DataType?
Thank.
Fazle
0
Comments
-
I have resolved the issue: instead of using NAV Text Variable to send to DotNet method, I used a DotNet String Variable (System.String.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089').0
-
@fazlehasan For any of the text variable in DotNet, you need to use something in DotNet only OR else system will keep prompting for the data type issue.
You may attempt using Variant if you wish to use the NAV one.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/1
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