get the difference between two tables

guedestorm

Member
Joined
Apr 26, 2011
Messages
6
Programming Experience
Beginner
I need to get the difference between two tables
First I tried this
​ Dim DBinserir

'.AsEnumerable()


DBinserir = From e In dbExcel, m In DbMTR Where e.Field(Of String)("Ticket") <> m.Field(Of String)("Ticket") Select e


Dim coisas As List(Of String)


For Each coisa In DBinserir
coisas.Add(coisa)
Next

And throws a InvalidCastException
Saying it is not possible to convert double to String
So I tried this
Dim DBinserir

'.AsEnumerable()


DBinserir = From e In dbExcel, m In DbMTR Where e.Field(Of Double)("Ticket") <> m.Field(Of Double)("Ticket") Select e


Dim coisas As List(Of String)


For Each coisa In DBinserir
coisas.Add(coisa)
Next
Again throws a InvalidCastException
Any idea?
 
It sounds like maybe that column is String in one and Double in the other. Have you actually checked what the data type is of the two columns in question? If that is the case then you could use (Of String) for one of them and (Of Double) for the other and call ToString on the value, so you can compare String with String.
 
It sounds like maybe that column is String in one and Double in the other. Have you actually checked what the data type is of the two columns in question? If that is the case then you could use (Of String) for one of them and (Of Double) for the other and call ToString on the value, so you can compare String with String.

Thank you So Much

but now I saw that my linq query is wrong

thanks for the help, I just nedd to fix it now
[FONT=arial, sans-serif]
[/FONT]
 
Back
Top