Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(name.trim().equals("")|| supp.trim().equals("")||range.trim().equals("")||size.equals("")||price.equals(""))
- z = "Please enter all fields";
- else
- {
- try
- {
- con = connectionclass(); // Connect to database
- if (con == null)
- {
- z = "Check Your Internet Access!";
- }
- else
- {
- String query = "BEGIN" +
- "IF NOT EXISTS(Select * from cc_lining)" +
- "BEGIN " +
- "INSERT INTO cc_lining (lining_id,lining_name, lining_range, lining_supplier, lining_width, lining_unit_price) VALUES ('"+id.toString()+"','"+ name.toString()+"','"+ range.toString()+"','"+ supp.toString()+"','"+size.toString()+"','"+price.toString()+"')" +
- "END" +
- "END";
- Statement stmt = con.createStatement();
- ResultSet rs = stmt.executeQuery(query);
- if(rs.next())
- {
- isSuccess=true;
- con.close();
- }
- else
- {
- z = "Invalid!";
- isSuccess = false;
- }
- }
- }
- catch (Exception ex)
- {
- isSuccess = false;
- z = ex.getMessage();
- }
- }
- return z;
- }
- }
Add Comment
Please, Sign In to add comment