none
圖片存入informix 出現的錯誤訊息,請問是哪裡出錯? RRS feed

  • 問題

  • 下面這段是我寫的程式碼

     

    Code Snippet

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click 

       

            Using conn As New OdbcConnection(strCN)

                Using command As New OdbcCommand("insert into abc(name,pic,remark) values('BBB','@pic','test')", conn)

     

                    Dim buf() As Byte

     

                    Dim ms As New System.IO.MemoryStream
                    Me.PictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
                    buf = ms.GetBuffer

                    command.Parameters.Add("@pic", OdbcType.VarBinary).Value = buf
                    conn.Open()
                    command.ExecuteNonQuery()


                    MsgBox("successfully")

     

                End Using

            End Using

     

    End Sub

     

    存入的資料庫是informix,而圖片的欄位型態是Byte

     

    可是當我執行的時候會出現此錯誤訊息

    ERROR [HY000] [Informix][Informix ODBC Driver][Informix]Illegal attempt to convert Text/Byte blob type.

     

    請問是我哪裡寫錯了?

     

    謝謝

     

    2008年7月7日 上午 07:23

解答

所有回覆