Click here to Skip to main content
15,671,597 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to retrieve a picture I saved my database and store in a new datatable "Answered", but any time the codes run I get this error-"Error Iconvertible: cannot convert sqldb bytes to type bytes". The code I am using is given below, please help me overcome this error.

dt = New DataTable("Answered")
            dt.Columns.Add("Serial", GetType(Integer))
            dt.Columns.Add("question", GetType(String))
            dt.Columns.Add("choice1", GetType(String))
            dt.Columns.Add("choice2", GetType(String))
            dt.Columns.Add("choice3", GetType(String))
            dt.Columns.Add("choice4", GetType(String))
            dt.Columns.Add("correct", GetType(String))
            dt.Columns.Add("questionImage", GetType(Bytes))
            dt.Columns.Add("selected", GetType(Integer))

            'this code is for adding to the table TEST
            Dim r As DataRow

             For Each r In ds.Tables("vExamQuestionsda").Rows
                dr = dt.NewRow
                dr("Serial") = dt.Rows.Count + 1
                dr("question") = r.Item("question")
                dr("choice1") = r.Item("choice1")
                dr("choice2") = r.Item("choice2")
                dr("choice3") = r.Item("choice3")
                dr("choice4") = r.Item("choice4")
                dr("correct") = r.Item("correct")
                dr("questionImage") = r.Item("questionImage")
                dr("selected") = -1

Updated 17-Aug-13 2:27am
syed shanu 19-Aug-13 2:09am    
Check this links
OsoJames 19-Aug-13 4:01am    
thanks for the help @syed shanu
OsoJames 20-Aug-13 4:30am    
I've discovered that the problem I am facing is because I am trying to convert a byte[] to byte, does why that error come up. Any help with that?

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