Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Guesuper Guesuper is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 408
Rep Power: 14
Guesuper mempunyai hidup yang Normal
Default [help] java + sqlite, gak bisa update

Malem gan...



Ane kan lagi belajar buat aplikasi java, dan db-nya pakai sqlite...



Ane udah bisa konek.. dah bisa select...



sekarang masalahnya ketika coba buat update...



waktu method update ane jalanin, sukses, (waktu ane select lagi udah terupdate datanya)..



tapi setelah aplikasi di close, dan buka db yang tadi... datanya gak keupdate gan... jadi balik lagi kayak pas sebelum diupdate tadi....



ini method yang ane pakai buat update...




Code:

public void edit_content(String table_name, String code, String new_type, String new_content, String new_detail){
try {

st = connection.createStatement();
//int update_rst = st.executeUpdate("UPDATE " +table_name +" SET type='Q',content='APAKAH?',detail='APAKAH?' WHERE code='1111' ");
int update_rst = st.executeUpdate("UPDATE " +table_name +" SET type='" +new_type +"', content='"+new_content +"', detail='" +new_detail +"' WHERE code=" +code);
JOptionPane.showMessageDialog(null, "Update Success !");
connection.commit();



} catch (SQLException ex) {
Logger.getLogger(Connect.class.getName()).log(Leve l.SEVERE, null, ex);
}

}

Ane dah coba cari2 di google nemu yang pakai setAutoCommit(), sama commi() gak jadi juga gan..



Mohon bantuanya....







Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 11:05 AM.


no new posts