Click here to Skip to main content
15,887,302 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
Error thrown due to the .Field(Of Integer)("columnname"), please refer to the following code:
-----------------------------------------------------------------------------

VB
DtSetBO = New System.Data.DataSet
MyCommandBO.Fill(DtSetBO)
Dim BOTable As DataTable = DtSetBO.Tables("InvtDetailTbl")

Dim query = From InvtDetailTbl In BOTable.AsEnumerable()
   Where InvtDetailTbl.Field(Of String)("Product Line") <> ""
  Order By InvtDetailTbl.Field(Of String)("MES Product") Ascending,
           InvtDetailTbl.Field(Of Integer)("Received Date Ageing") Descending Select InvtDetailTbl

Dim sortedInvt As DataTable = query.CopyToDataTable()
Dim view As DataView = New DataView(sortedInvt)
Dim sortedInvtQuery = From rowView As DataRowView In view
          Select rowView
DataGridView1.DataSource = sortedInvtQuery.ToList()


----------------------------------------------------------------------------

Please advise what should the correct statement for above issue.

What I have tried:

Tried on CInt, .Field(of String), .Field(of double).
Error persist.
Posted
Updated 23-Oct-17 18:04pm
v3
Comments
Richard MacCutchan 23-Oct-17 9:05am    
You are trying to cast a field of one type to something totally different, e.g. String to Int. This is not allowed as it requires some type of data converter.

1 solution

<big></big>InvtDetailTbl.Field(Of DOUBLE)("Received Date Ageing") Descending Select InvtDetailTbl
 
Share this answer
 
Comments
Richard Deeming 24-Oct-17 12:30pm    
So the solution to your question is something which you told us you'd already tried?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900