判断sql中有没有重复项

2019-04-15 17:10发布

   sql = "if not exists(select * from Sw_Shopping where Name='" + name + "') insert into Sw_Shopping(UserIP,SelectId,Name,Pic,Dec,Sw_Price,Carriage,GoodsNum) values ('" + UserIP + "','" + Id + "','" + name + "','" + pic + "','" + dec + "','" + Sw_Price + "','" + Carriage + "',1)";