How to save fingerprints to SQL Server in C# using zk4500 reader?
<p>I am trying to save fingerprints to a SQL Server database in C#. I am using zk4500 fingerprint reader. I can scan the finger and a template is created. Now I am stuck on how to save these scanned fingerprints to the database. Below is the code which creates the template, kindly help on how I can save to the database.</p>

<pre><code>protected override void DefWndProc(ref Message m)
{
    switch (m.Msg)
    {
        case MESSAGE_FP_RECEIVED:
            {
                try
                {
                    MemoryStream ms = new MemoryStream();
                    //Template.Serialize(ms);                           
                    BitmapFormat.GetBitmap(g_FPBuffer, g_nWidth, g_nHeight, ref ms);
                    Bitmap bmp = new Bitmap(ms);
                    this.picFP.Image = bmp;
                    ms.Position = 0;
                    BinaryReader br = new BinaryReader(ms);
                    Byte[] bytes = br.ReadBytes((Int32)ms.Length);

                    txtStatus.Text = "IMAGE_READY";

                    int ret = 0;
                    int id = 0;
                    int score = 0;
                    int quality = 0;

                    if (g_IsRegister)
                    {
                        Array.Clear(g_RegTmp, 0, g_RegTmp.Length);
                        ret = ZKFinger10.BIOKEY_EXTRACT(g_biokeyHandle, g_FPBuffer, g_RegTmp, 0);
                        if (ret &gt; 0)
                        {
                            Array.Copy(g_RegTmp, g_RegTmps[g_RegisterTimeCount++], ret);

                            // Get fingerprint quality
                            quality = ZKFinger10.BIOKEY_GETLASTQUALITY();
                            txtQuality.Text = quality.ToString();

                            txtPrompt.Text = string.Format("Still press finger {0} time", REGISTER_FINGER_COUNT - g_RegisterTimeCount);

                            if (g_RegisterTimeCount == REGISTER_FINGER_COUNT)
                            {
                                Array.Clear(g_RegTmp, 0, g_RegTmp.Length);

                                int size = 0;

                                unsafe
                                {
                                    fixed (byte* Template1 = g_RegTmps[0])
                                    {
                                        fixed (byte* Template2 = g_RegTmps[1])
                                        {
                                            fixed (byte* Template3 = g_RegTmps[2])
                                            {
                                                byte*[] pTemplate = new byte*[3] { Template1, Template2, Template3 };

                                                size = ZKFinger10.BIOKEY_GENTEMPLATE(g_biokeyHandle, pTemplate, 3, g_RegTmp);
                                            }
                                        }
                                    }
                                }

                                if (size &gt; 0)
                                {
                                    ZKFinger10.BIOKEY_DB_ADD(g_biokeyHandle, ++g_RegisterCount, size, g_RegTmp);
                                    txtPrompt.Text = string.Format("Register succeeded, fid={0}, totalCount={1}", g_RegisterCount, ZKFinger10.BIOKEY_DB_COUNT(g_biokeyHandle));

                                    g_IsRegister = false;
                                }
                                else
                                {
                                    txtPrompt.Text = "Register failed";
                                }
                                g_RegisterTimeCount = 0;
                            }
                        }
                        else
                        {
                            txtPrompt.Text = "Extract template failed";
                        }
                    }               
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
            break;

        default:
            base.DefWndProc(ref m);
            break;
    }
}
</code></pre>