Using DotNet DataTable in C/AL

viperk
Member Posts: 12
Hi,
I'm trying to send a datatable from a C# app. to a codeunit in NAV.
My problem is that i can't figure out how to use the Rows property on my datatable.
I would like to select a specific column by using this syntax (in C/AL)
myCALVariable := myDataTableFromDotNet.Rows.ToString();
but when i compile i get a compilation error saying that the Rows variabel is defined with fewer dimensions. Is there a way around this or shouldn't i use datatables from dotnet in my c/al code?
thanks in advance
I'm trying to send a datatable from a C# app. to a codeunit in NAV.
My problem is that i can't figure out how to use the Rows property on my datatable.
I would like to select a specific column by using this syntax (in C/AL)
myCALVariable := myDataTableFromDotNet.Rows.ToString();
but when i compile i get a compilation error saying that the Rows variabel is defined with fewer dimensions. Is there a way around this or shouldn't i use datatables from dotnet in my c/al code?
thanks in advance
0
Comments
-
One thing I've seen is that methods that are overloaded, they appear as separate lines when you hit F5. And you select the one with correct parameters.
You might have selected the wrong one. Or probably just pasted your code? I would try that.0 -
The exception comes from the property "Rows" not a method.
And there is only one "Rows" property to choose. This property returns a collection, but when using it in C# i can also call it with an index (Rows[x]) to retrieve a specific column.
But i don't seem to be able to use this index in C/AL.0 -
This may not be much help but we had a similar problem trying to consume .net arrays because we could not access the array index. What we ended up doing was creating a wrapper DLL that adding a methods to return the size of the array and added getObject(int i) and setObject(object o, int i) methods for getting and setting objects. A similar approach might be an option for you if you can't find another way of consuming the data table in C/AL.0
-
Try to search for method ".Value(index)" or ".Item(index)" instead [] operator.0
-
thanks a lot! I'll try your suggestions0
-
As suggested by kine you have to use the Item() method, the [] will not work in C/AL.
/henrik“This posting is provided "AS IS" with no warranties, and confers no rights.”
Henrik Metzger, Software Development Engineer, Dynamics NAV
MSFT0
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