I use VB.NET 2005 & your control v4.0
I try to save a Serialized Class into a mySQL (4.1.16) BLOB field with the following code (which seems to work)
Translated. The end of the stream was reached, before the processing was locked
Code: Select all
Dim usr As New clsBenutzer
        usr.Nachname = "Bacik"
        usr.Vorname = "Harald"
        usr.Tätigkeiten = New clsBenutzer.Benutzer() {clsBenutzer.Benutzer.Administrator, _
            clsBenutzer.Benutzer.Filialleiter}
        Dim form As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
        ' --- Serialisieren
        Dim Stream As New System.IO.MemoryStream
        form.Serialize(Stream, usr)
        mySQLConnection.Open()
        mySQLCommand.Connection = mySQLConnection
        mySQLCommand.CommandText = "Update Mitarbeiter Set Rolle= @Data where " & _
            "ID=1"
        mySQLCommand.Parameters.AddWithValue("@Data", Stream.ToArray)
        mySQLCommand.ExecuteNonQuery()
        Stream.Close()
        mySQLConnection.Close()
        MsgBox("OK")Code: Select all
mySQLConnection.Open()
        mySQLCommand.Connection = mySQLConnection
        mySQLCommand.CommandText = "Select Rolle from Mitarbeiter where ID=1"
        Dim dAdapter As New CoreLab.MySql.MySqlDataAdapter(mySQLCommand)
        Dim dTable As New System.Data.DataTable
        dAdapter.Fill(dTable)
        Dim dRow As System.Data.DataRow = dTable.Rows(0)
        Dim b As Byte() = CType(dRow("Rolle"), Byte())
        Dim Stream As New System.IO.MemoryStream(b)
        Stream.Seek(0, IO.SeekOrigin.Begin)
        Dim usr As New clsBenutzer
        Dim form As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
        ' Here I get the error
        usr = form.Deserialize(Stream)
        MsgBox("OK")
        mySQLConnection.Close()
THX