我想在C#ASP.net中建立一个BioMetric Attendence系统

时间:2015-08-19 03:57:54

标签: c# asp.net

我对FingerPrint Scanner一无所知。任何人都知道如何将fingerPrint保存到数据库中并匹配C#Asp.net中的fingerPrints。我正在使用DigitalPersona和Microsoft Visual Studio 2010。 你给我一些代码片段吗? 我将非常感谢你......

此致 Zargham Nazeer Malik

1 个答案:

答案 0 :(得分:-1)

您正在使用数字角色。安装后,文件夹将保存在c目录中。请检查,该文件夹中是否存在代码。它已经可以注册并验证指纹

下面的代码是保存在数据库中....

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 = "";
}