C#向数据库中插入一条不重复的记录

如果数据库中存在这条记录就不插入,如果不存在就插入。

insert into 表 (字段1 ,字段2,f_字段3) select top 1  @字段1值@字段2值,@字段3值  where not exists ( select 1 from 表 where 字段1=@字段1值 )

posted @ 2015-04-19 15:49  jiang_jiang  阅读(587)  评论(0编辑  收藏  举报