看你的具体写数据库的sql
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/
string sql = "insert into users (FingerCode,GongHao) values (" + byteArray + ",'" + name + "')";
Guan.DBUtility.DbHelperSQL.ExecuteSql(sql);运行时报错:其他信息: 缺少对象或列名,或者对象或列名为空。对于 SELECT INTO 语句,请确保每列均具有名称。对于其他语句,请查找空的别名。不允许使用定义为 "" 或 [] 的别名。请添加名称或单个空格作为别名。 在此上下文中不允许使用名称 "System.Byte"。有效表达式包括常量、常量表达式和变量(在某些上下文中)。不允许使用列名。
cmd=new sqlcommand(sql,con);
cmd.parameter.addwithvalue("@FingerCode",sqldbtype.binary).value=byteArray ;
con.open();
cmd.executenonquery();
con.close();
cmd=new sqlcommand(sql,con);
cmd.parameter.addwithvalue("@FingerCode",sqldbtype.binary).value=byteArray ;
con.open();
cmd.executenonquery();
con.close(); ---用此方法解决了,不管字段 是 binary 还是 image 都成功
谢谢以上朋友们