SQL中if语句是最常见也是最常用的SQL语句之一,下面就将为您举例说明SQL中if语句的用法,希望对您学习SQL中if语句的使用能够有些许帮助。
- _sql = " if not exists (select * from ProDesignSheet5 where Sheet5ID = '" + this.Sheet5id + "') "
- + " insert into ProDesignSheet5 values('" + this.Sheet5id
- + "','" + this.Consplacepbfee.ToString()
- + "','" + this.Searchtestfee.ToString()
- + "','" + this.Ccdesignfee.ToString()
- + "','" + this.Propreparefee.ToString()
- + "','" + this.Elecfee.ToString()
- + "','" + this.Workerdqfee.ToString()
- + "','" + this.Cjzpgdqfee.ToString()
- + "','" + this.Dxsgjxdqfee.ToString()
- + "','" + this.Debzglfee.ToString()
- + "','" + this.Jsqtzdkrate.ToString()
- + "','" + this.Gczljdfee.ToString()
- + "','" + this.Yuntufee.ToString()
- + "','" + this.Jfgzjgzfee.ToString()
- + "','" + this.Wsdyrfee.ToString()
- + "','" + this.Whclfee.ToString()
- + "','" + this.Bgyffee.ToString()
- + "','" + this.Yytfee.ToString()
- + "','" + this.Hlhtfee.ToString()
- + "','" + this.Jfxtfee.ToString()
- + "','" + this.Ybgjfee.ToString()
- + "','" + this.Gxzfzfee.ToString()
- + "','" + this.Lyglfee.ToString()
- + "','" + this.Jfzjfee.ToString()
- + "','" + this.Gdzjfee.ToString()
- + "','" + this.Gdlxlzjfee.ToString()
- + "','" + this.Workteamfee.ToString()
- + "','" + this.Condeptfee.ToString()
- + "','" + this.Tower.ToString()
- + "','" + this.Servicefee.ToString()
- + "','" + this.Checkfee.ToString()
- + "','" + this.Other.ToString()
- + "','" + this.ItemNum.ToString()
- + "','" + this.ItemName.ToString()
- + "','" + this.PassId.ToString()
- + "')"
- + " else update ProDesignSheet5 set Consplacepbfee='" + this.Consplacepbfee.ToString()
- + "',Searchtestfee='" + this.Searchtestfee.ToString()
- + "',Ccdesignfee='" + this.Ccdesignfee.ToString()
- + "',Propreparefee='" + this.Propreparefee.ToString()
- + "',Elecfee='" + this.Elecfee.ToString()
- + "',Workerdqfee='" + this.Workerdqfee.ToString()
- + "',Cjzpgdqfee='" + this.Cjzpgdqfee.ToString()
- + "',Dxsgjxdqfee='" + this.Dxsgjxdqfee.ToString()
- + "',Debzglfee='" + this.Debzglfee.ToString()
- + "',Jsqtzdkrate='" + this.Jsqtzdkrate.ToString()
- + "',Gczljdfee='" + this.Gczljdfee.ToString()
- + "',Yuntufee='" + this.Yuntufee.ToString()
- + "',Jfgzjgzfee='" + this.Jfgzjgzfee.ToString()
- + "',Wsdyrfee='" + this.Wsdyrfee.ToString()
- + "',Whclfee='" + this.Whclfee.ToString()
- + "',Bgyffee='" + this.Bgyffee.ToString()
- + "',Yytfee='" + this.Yytfee.ToString()
- + "',Hlhtfee='" + this.Hlhtfee.ToString()
- + "',Jfxtfee='" + this.Jfxtfee.ToString()
- + "',Ybgjfee='" + this.Ybgjfee.ToString()
- + "',Gxzfzfee='" + this.Gxzfzfee.ToString()
- + "',Lyglfee='" + this.Lyglfee.ToString()
- + "',Jfzjfee='" + this.Jfzjfee.ToString()
- + "',Gdzjfee='" + this.Gdzjfee.ToString()
- + "',Gdlxlzjfee='" + this.Gdlxlzjfee.ToString()
- + "',Workteamfee='" + this.Workteamfee.ToString()
- + "',Condeptfee='" + this.Condeptfee.ToString()
- + "',Tower='" + this.Tower.ToString()
- + "',Servicefee='" + this.Servicefee.ToString()
- + "',Checkfee='" + this.Checkfee.ToString()
- + "',Other='" + this.Other.ToString()
- //+ "',ItemNum='" + this.ItemNum.ToString()
- //+ "',ItemName='" + this.ItemName.ToString()
- //+ "',PassId='" + this.PassId.ToString()
- + "' where Sheet5id ='" + this.Sheet5id + "'";
【编辑推荐】