Skip to main content
Solved

Can we pass datatable as input to a C# DLL as a parameter ?

  • January 14, 2023
  • 5 replies
  • 507 views

Forum|alt.badge.img+1

Hi Team,

 

I wanted to pass DataTable as input parameter to C# DLL. I am unable to find Datatable parameter in the parameter type. Is it possible to pass Datatable as an input?

 

Is there a workaround to pass a datatable as parameter?

 

DLL Parameter

 

Best answer by rbkadiyam

@anandc  check this article if it can help - https://www.c-sharpcorner.com/UploadFile/87b416/passing-datatable-to-storeprocedure-as-parameter-in-C-Sharp/

5 replies

rbkadiyam
Premier Pathfinder | Tier 7
Forum|alt.badge.img+17
  • Premier Pathfinder | Tier 7
  • Answer
  • January 14, 2023

Forum|alt.badge.img+1
  • Author
  • Cadet | Tier 2
  • February 1, 2023

Thanks for sharing. This article mentions passing a list and then converting the list to Datatable. Can we directly pass datatable variable?


Marc Mueller
Most Valuable Pathfinder
Forum|alt.badge.img+17
  • Most Valuable Pathfinder
  • February 1, 2023

Hi @anandc ,

when i remember correct this is not possible just List and Dictionary.


Forum|alt.badge.img+2
  • Navigator | Tier 3
  • February 2, 2023

Forum|alt.badge.img
  • Cadet | Tier 2
  • April 15, 2024

 There is one possible way. In Run Function you need to pass Datatable as String[,] as Input Parameter.



DLL Function arguments must be as below. and should return the multidimensional array.

 

you first need to convert this 2d array into datatable and after that perform required operation on that datatable and again convert it back to array.

it works.
reach out to me if you need help.