Sonali Khade

Sonali Khade

  • NA
  • 44
  • 0

Convert list to datatable

Jul 9 2012 4:50 AM

I am working on asp.net 4.0 using vb.net

My function returns List of anonymous type

my function is 


Public
Function GetAdditionalSupplierRecordsById(STATUS As String, SUPPLIER_PROFILE_ID As Integer) As System.Collections.IEnumerable Implements Entities.ICommonService.GetAdditionalSupplierRecordsById
Using context As New CIPSCS
Dim strQueryFilter As String = String.Empty
Dim query = From AddSup In context.ADDITIONAL_SUPPLIER_DETAIL
Join Vdr In context.VENDORs On AddSup.VENDOR_NUMBER Equals Vdr.VENDOR_NUMBER
Join Sup In context.SUPPLIER_PROFILE On AddSup.SUPPLIER_PROFILE_ID Equals Sup.SUPPLIER_PROFILE_ID
Where (AddSup.STATUS = STATUS And Sup.SUPPLIER_PROFILE_ID = SUPPLIER_PROFILE_ID)
Order By Vdr.VENDOR_NAME
Select Vdr.VENDOR_NUMBER, Vdr.VENDOR_NAME, AddSup.UPDATE_DATE, AddSup.INVOICE_DATE, AddSup.INVOICE_NUMBER, Vendor_Number_Name = Vdr.VENDOR_NUMBER + " - " + Vdr.VENDOR_NAME, AddSup.ADDITIONAL_SUPPLIER_DETAIL_ID

Return query.ToList()
End Using
End Function



Please send the code to convert this functions result to datatable.


Answers (1)