本文介绍了如何将指纹模板移至oracle数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在与数字角色一起使用u 4500和oracle数据库,我遇到了将指纹模板存储到数据库的问题,这是我的部分代码
i am working with digital persona u are u 4500 and oracle database, i got the problem to store fingerprint template to database, here part of my code
string sqlInsert = "insert into mytable(ID,FINGERPRINT)";
sqlInsert += "values (:i_ID,:i_FINGERPRINT)";
OracleParameter iID = new OracleParameter();
iID.OracleDbType = OracleDbType.Varchar2;
iID.Value = textBox1.Text;
iID.ParameterName = "i_ID";
OracleParameter iFINGERPRINT = new OracleParameter();
iFINGERPRINT.OracleDbType = OracleDbType.Blob;
iFINGERPRINT.Direction = ParameterDirection.Input;
iFINGERPRINT.Value = Data.Templates[5];
iFINGERPRINT.ParameterName = "i_FINGERPRINT";
cmdInsert.Parameters.Add(iID);
cmdInsert.Parameters.Add(iFINGERPRINT);
cmdInsert.ExecuteNonQuery();
注意:Data.Templates [5]是指纹模板格式
note : Data.Templates[5] is a fingerprint template format
我收到错误消息无效的参数绑定"这是什么意思?有人可以帮我吗?我该怎么办?预先感谢
i got error "invalid parameter binding"what does it mean?could somebody help me? what should i do?thanks in advance
推荐答案
string path="C:\\Fingerprintimage.bmp";
FileStream fls;
fls = new FileStream(path, FileMode.Open, FileAccess.Read);
byte[] blob = new byte[fls.Length];
fls.Read(blob, 0, System.Convert.ToInt32(fls.Length));
fls.Close();
string q="";
q = "insert into mytable(ID,FINGERPRINT) values(" + 1 + ", :BlobParameter)";
OracleParameter blobParameter = new OracleParameter();
blobParameter.OracleDbType = OracleDbType.Blob;
blobParameter.ParameterName = "BlobParameter";
blobParameter.Value = blob;
cmd = new OracleCommand(q, conn);
cmd.Parameters.Add(blobParameter);
cmd.ExecuteNonQuery();
这篇关于如何将指纹模板移至oracle数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!