Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Creative commons Attribution-NonCommercial license. http://creativecommons.org/licenses/by-nc/2.5/au/deed.en_GB NO WARRANTY IS GIVEN OR IMPLIED, USE AT YOUR OWN RISK.
 
 package base.jee.api.sql.util;
 
public class UpdateSetting {
	public static void updateSetting(Connection cString nameString valuethrows SQLException {
		PreparedStatement s = c.prepareStatement("update setting set value=? where name=?");
		s.setString(1, value);
		s.setString(2, name);
		if(s.executeUpdate() == 0) {
			PreparedStatement t = c.prepareStatement("insert into setting (name,value) values(?,?)");
			t.setString(1, name);
			t.setString(2, value);
			t.close();
		}
		s.close();
	}
New to GrepCode? Check out our FAQ X