Demo entry 6655756

ds

   

Submitted by sd on Oct 28, 2017 at 06:22
Language: Java. Code size: 644 Bytes.

public void commitData(String str) {
		String[] splitString = str.split("\\|");
		String ten = splitString[0];
		String kinhdo = splitString[1];
		String vido = splitString[2];
		try {
			Statement st = conn.createStatement();
			st.executeUpdate("INSERT INTO DULIEU (ten,kinhdo,vido) VALUES (" + "\'" + ten + "\'" + "," +  "\'" + kinhdo  + "\'" + ","  + "\'" + vido + "\'" + ");");
			System.out.println("Saved data to database successfully!");
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		finally {
			 if (conn != null) try { conn.close(); } catch(Exception e) {} 
			 }
	}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).