i need help with a little problem.
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);
HL.RegistroHuella(ComboBx, LabelMs, bytes);
}
This is the save button...
public void RegistroHuella(ComboBox ComboBx, Label LabelMs, Byte[] bytes)
{
try
{
string hola;
ConexionHuella();
hola = ComboBx.SelectedIndex.ToString();
DbCommand = DbConnection.CreateCommand();
DbCommand.CommandText = "SELECT * FROM HUELLAS WHERE ID = " + hola + "";
DbReader = DbCommand.ExecuteReader();
if (DbReader.Read())
{
LabelMs.Text = "El estudiante ya existe en la base de datos";
}
else
{
DbReader.Close();
DbCommand.CommandText = "INSERT INTO HUELLAS VALUES('" + hola + "','" + bytes + "')";
DbReader = DbCommand.ExecuteReader();
if (DbReader.RecordsAffected > 0)
{
LabelMs.Text = "El estudiante ha sido registrado correctamente.";
}
else
{
LabelMs.Text = "Hubo un problema al momento de registrar a este usuario.";
}
}
DbConnection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
//LabelMs.Text = ex.Message;
}
}
The problem is the next... When i pressed the save button, the code generates a register in my odbc but in the field "Huella" didn't insert well.
The image: -> Problem