我byte[]对应的mysql类型为blob,byte[]大小5000代码为:
theMySqlCommand.Parameters.Clear();
theMySqlCommand.CommandType = System.Data.CommandType.Text;
theMySqlCommand.CommandText = "insert into fingertemplate (userID, templateID, templateData) values (@userID, @templateID, @templateData);";
MySqlParameter param = new MySqlParameter("@userID", MySqlDbType.UInt32);
param.Value = infoEx.template.userID;
theMySqlCommand.Parameters.Add(param);
param = new MySqlParameter("@templateID", MySqlDbType.Int32);
param.Value = infoEx.template.templateID;
theMySqlCommand.Parameters.Add(param);
param = new MySqlParameter("@templateData", MySqlDbType.Blob);
param.Value = infoEx.template.templateData; //为byte[]
theMySqlCommand.Parameters.Add(param);
reslut = theMySqlCommand.ExecuteNonQuery();为什么我这样操作有时能插入输入,有时又不能包sql语句错误,我的byte[]也是指纹模板信息。
报错我觉得是byte[]的内容编码引起,但不知掉如何解决。
报错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' \a?w[曇?>揎q羼饙 筤.噞h逘 俛W[曇???f _垰??邾&S
侫w[懩閨絿:]灈W堪=宙鍿 0' at line 1
theMySqlCommand.Parameters.Clear();
theMySqlCommand.CommandType = System.Data.CommandType.Text;
theMySqlCommand.CommandText = "insert into fingertemplate (userID, templateID, templateData) values (@userID, @templateID, @templateData);";
MySqlParameter param = new MySqlParameter("@userID", MySqlDbType.UInt32);
param.Value = infoEx.template.userID;
theMySqlCommand.Parameters.Add(param);
param = new MySqlParameter("@templateID", MySqlDbType.Int32);
param.Value = infoEx.template.templateID;
theMySqlCommand.Parameters.Add(param);
param = new MySqlParameter("@templateData", MySqlDbType.Blob);
param.Value = infoEx.template.templateData; //为byte[]
theMySqlCommand.Parameters.Add(param);
reslut = theMySqlCommand.ExecuteNonQuery();为什么我这样操作有时能插入输入,有时又不能包sql语句错误,我的byte[]也是指纹模板信息。
报错我觉得是byte[]的内容编码引起,但不知掉如何解决。
报错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' \a?w[曇?>揎q羼饙 筤.噞h逘 俛W[曇???f _垰??邾&S
侫w[懩閨絿:]灈W堪=宙鍿 0' at line 1
解决方案 »
- mysql根据查询结果再查询?
- 关于MySQL中模糊查询语句的写法?
- 设计一个方案
- SQL递归算法
- 不包含某字符串用SQL查询怎么写
- 如何在MYSQL中实现这样的需求?
- 这个sql语句怎么写?(在mysql中)
- jjj
- HA-Slave一直处于Reading event from the relay log状态
- 自己写了个php重置游戏内角色技能及天赋的功能,但是在PHP内无法执行,SQL语句在mysql里是有效的,求解!
- 真心不会做,求大神解答,急!!!!!!!!!!!!!!!!
- win7环境下mysql启动报Table 'mysql.host' doesn't exist,已经改了datadir
param = new MySqlParameter("@templateData", MySqlDbType.Blob);
param.Value = infoEx.template.templateData; //为byte[]
我觉得是这个byte数组里面有转义字符造成的,这个如何处理呢?