It sounds like you don't really have a column named
Image
in the dataTable named
Details
. Can you post the code that you use to create and add that column? I'm guessing it should look something like this:
ds.Tables("Details").Columns.Add("Image", System.Type.GetType("System.Byte[]"))
Also, just as a side note, I noticed that you are not using a For Each loop which would make your code a lot cleaner and is very nice and easy to use. Instead of doing a regular For Loop where you have to specify an integer to increment and step, etc. You can use a For Each and it knows to just iterate through a collection. Here is a link that explains it:
For Each...Next Statement[
^]
Also, there is a quicker way to grab all of the bytes in a file. You can use
System.IO.File.ReadAllBytes(strFilePath)
.
So once you get your column properly added to the DataTable in your DataSet, you could simplifiy your loop code to this:
For Each row As DataRow In ds.Tables("Details").Rows
If System.IO.File.Exists(row("Path").ToString) Then
row("Image") = System.IO.File.ReadAllBytes(row("Path").ToString)
End If
Next
Hope this helps.