Missing image data?

pachjo

Well-known member
Joined
Dec 12, 2006
Messages
370
Programming Experience
10+
Hi, for some reason the code that used to work no longer does! The only difference is that I started the app in 2005 but have now installed and converted it to 2008. Even if I open 2005 the old project no longer works!

I have a .mdf file that has a table with a column of type image.

When I save a record to the table and check the length of the data being written it is a large number and does not error so I assume it is being written.

But now when I run this code the field that has the image is always system.dbnull and thus bombs!

VB.NET:
Dim ds As New PDDataSet

Dim ro As PDDataSet.TransactionsRow

' this line always worked before but have commented out to try exact row type

'Dim dr() As DataRow

' but even with this still no joy!

Dim dr() As PDDataSet.TransactionsRow

' select filter to extract transaction  

Dim s As String = String.Format("{0}'{1}'", "tranID = ", strTranID)

' try to retrieve transation from transaction table

dr = Me.PDDataSet1.Transactions.Select(s)

' if found process

If (dr.GetUpperBound(0) >= 0) Then

      ' create a new transaction row to append to report dataset

       ro = ds.Transactions.NewTransactionsRow

       ' set values in new row

       With ro

               ' dr(0) contains all the data as expected

               .tranID = dr(0).Item(0)
               .categoryID = dr(0).Item(1)
               .tran_date = dr(0).Item(2)
               .tran_amount = dr(0).Item(3)
        
               ' except the image is now always system.dbnull?

                .image_scan = dr(0).Item(4)
        
       End With

End If
 

Latest posts

Back
Top