Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Not tested, but I believe the code should look like this. Basically, we substitute a <code>MemoryStream</code> and set its position back to <code>0</code> after writing the fingerprint data into it so that the data may be read back and formatted for storage, leaving the rest of the code in tact (excepting for the name change)</p> <pre><code>private void SaveButton_Click(object sender, EventArgs e) { MemoryStream fingerprintData = new MemoryStream(); Template.Serialize(fingerprintData); fingerprintData.Position = 0; BinaryReader br = new BinaryReader(fingerprintData); Byte[] bytes = br.ReadBytes((Int32)fingerprintData.Length); //Insert the file into database SqlConnection cn = new SqlConnection("Data Source=10.115.5.3; Initial Catalog=EnrollmentSampledb;Integrated Security=SSPI;"); SqlCommand cmd = new SqlCommand("INSERT INTO tblUser VALUES(@ID_NUMBER, @FIRSTNAME, @LASTNAME, @FINGERPRINT, @DATE_ADDED, @DATE_MODIFIED)", cn); cmd.Parameters.Add("ID_NUMBER", SqlDbType.NVarChar).Value = tboxIdNum.Text; cmd.Parameters.Add("FIRSTNAME", SqlDbType.NVarChar).Value = tboxFname.Text; cmd.Parameters.Add("LASTNAME", SqlDbType.NVarChar).Value = tboxLname.Text; cmd.Parameters.Add("FINGERPRINT", SqlDbType.Image).Value = bytes; cmd.Parameters.Add("DATE_ADDED", SqlDbType.DateTime).Value = DateTime.Now; cmd.Parameters.Add("DATE_MODIFIED", SqlDbType.DateTime).Value = DateTime.Now; cn.Open(); cmd.ExecuteNonQuery(); cn.Close(); tboxIdNum.Text = ""; tboxFname.Text = ""; tboxLname.Text = ""; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload