title: Deserialize a Digital Persona template in VB.net
body: <p>Reading binary data out of the database, and I need to convert it back into a Digital Persona fingerprint template.  I'm not familiar with serialization and deserialization, so I could use a bit of help.  Here's what I tried:</p>
  
  <pre><code>Dim rsBioData As SqlDataReader = SQL.ExecuteReader
  Dim byteTemplate As Byte
  Dim memStreamTemplate As MemoryStream
  If rsBioData.HasRows Then
      While rsBioData.Read
          byteTemplate = rsBioData("BiometricData")
          memStreamTemplate = New MemoryStream(byteTemplate)
          Me.Template = DirectCast(template.DeSerialize(memStreamTemplate), DPFP.Template)
      End While
  End If
  rsBioData.Close()
  </code></pre>
  
  <p>I receive an error that template.DeSerialize(memStreamTemplate) does not create a value.</p>
  
  <p>For kicks, here's how I serialized the object to place it into the database.  I assume this part is working, since the binary data shows up in SQL server--just can't read it back out to see.</p>
  
  <pre><code>Dim str As New MemoryStream
  Enroller.Template.Serialize(str)
  Dim serializedTemplate As Byte() = str.ToArray()
  SQL.Parameters.AddWithValue("biometricData", serializedTemplate)
  </code></pre>
  
  <p>Thanks</p>