日期:2014-05-18 浏览次数:21043 次
com6.Parameters.Add(new SqlParameter("@Wlid", Wlid)); com6.Parameters.Add(new SqlParameter("@Kfid_to", Kfid_to)); com6.CommandText = "Select wlmc,gz,pz,gg,bz,zjm from wl where wlid like '@Wlid'; Select kfmc from kf where kfid = @Kfid_to";
------解决方案--------------------
两个查询语句分开写,设置参数
第一个:Select wlmc,gz,pz,gg,bz,zjm from wl where wlid like '@Wlid',这里不需要 '';
建议这样写好点:
sb.append("Select wlmc,gz,pz,gg,bz,zjm from wl ");
sb.append(" where wlid like '%' + ");
sb.append(" @Wlid ");
sb.append(" + '%' ");
------解决方案--------------------
byte[] FullPic = (byte[])de.Key; byte[] SmallPic = (byte[])de.Value; string FullPicSql = string.Format("insert into ProductFullPic (ProductID,Content) values({0},@pic)", productID); string SmallPicSql = string.Format("insert into ProductSmallPic (ProductID,Content) values({0},@pic)", productID); //插入原图 cmd.CommandText = FullPicSql; cmd.Parameters.Add("@pic", MySqlDbType.Blob); cmd.Parameters["@pic"].Value = FullPic; count += cmd.ExecuteNonQuery(); //插入缩略图 cmd.CommandText = SmallPicSql; //cmd.Parameters.Add("@pic", MySqlDbType.Blob); cmd.Parameters["@pic"].Value = SmallPic; count += cmd.ExecuteNonQuery();