Loading ...
Sorry, an error occurred while loading the content.
 

memanggil tanggal ke kazao calender & tampil tabel

Expand Messages
  • simi.java
    Gimana cara menampilkan data/tabel ke tabel ?? yg saya coba seperti ini.... void tampil_tabel(){ DefaultTableModel tab= new DefaultTableModel();
    Message 1 of 4 , Apr 1, 2009
      Gimana cara menampilkan data/tabel ke tabel ??
      yg saya coba seperti ini....
      void tampil_tabel(){
      DefaultTableModel tab= new DefaultTableModel();
      tab.addColumn("Nama");
      tab.addColumn("Tanggal Lahir");
      try {
      Class.forName("com.mysql.jdbc.Driver");
      Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/teman","root","");
      Statement stat=con.createStatement();
      String sql="select nama,tgllhr from Teman";
      ResultSet rs= stat.executeQuery(sql);
      while (rs.next()){
      tab.addRow(new Object[]{rs.getString("nama"),rs.getString("tgllhr")});
      // Ini tidak tampil di tabel karena field tgllhr tipe datanya date

      }
      jTable1.setModel(tab);


      } catch (Exception e) {
      }
      }

      kemudian Untuk memanggil isi field/record tabel tanggal di set ke kazao calender gimana ya??

      if (rs.next()){
      jTextField1.setText(rs.getString("nama"));
      "Kalau ke kazao kalender Gimana ya ??"
      }
    • onsir salman
      utk tampil ke tabel SQL= select NamaDB, NamaPT from tregdb + where Prog1= 1 order by namadb ; stmtDBinit = CAccessDB.condbinit.createStatement();
      Message 2 of 4 , Apr 1, 2009
        utk tampil ke tabel

        SQL="select NamaDB, NamaPT from tregdb " +
        " where Prog1='1' order by namadb " ;
        stmtDBinit = CAccessDB.condbinit.createStatement();
        rsTRegdb = stmtDBinit.executeQuery(SQL);
        ResultSetMetaData meta = rsTRegdb.getMetaData();
        int col = meta.getColumnCount();
        int baris = 0;
        while(rsTRegdb.next())
        {baris = rsTRegdb.getRow();}
        dataTable = new Object[baris][col];
        int x = 0;
        rsTRegdb.beforeFirst();
        while(rsTRegdb.next())
        {
        dataTable[x][0] = rsTRegdb.getString("NamaDB");
        dataTable[x][1] = rsTRegdb.getString("NamaPT");
        x++;
        }

        jTable1.setModel(new DefaultTableModel(dataTable,header) {
        boolean[] canEdit = new boolean [] { false, false };
        public boolean isCellEditable(int rowIndex, int columnIndex) {
        return canEdit [columnIndex];
        }
        });

        } catch (Exception e){


        set ke kazao

        kaz.setTimeInMillis(rsAmbilData.getDate("TglLahir").getTime());


        [Non-text portions of this message have been removed]
      • Ifnu bima
        ... ya jelas salah donk, tipe tgllhr kan date, trus diambil menggunakan getString. tab.addRow(new Object[]{rs.getString( nama ),rs.getDate( tgllhr )}); --
        Message 3 of 4 , Apr 1, 2009
          > while (rs.next()){
          > tab.addRow(new Object[]{rs.getString("nama"),rs.getString("tgllhr")});
          > // Ini tidak tampil di tabel karena field tgllhr tipe datanya date

          ya jelas salah donk, tipe tgllhr kan date, trus diambil menggunakan getString.

          tab.addRow(new Object[]{rs.getString("nama"),rs.getDate("tgllhr")});




          --
          Senior Engineer @ ArtiVisi Intermedia
          Java Training Center
          See our course @ artivisi.com

          http://ifnu.artivisi.com
          +62 856 9211 8687
          regards
        • simi.java
          ... udah pake rs.getDate( tgllhr ), juga gak mau mas, tapi dipe data date diganti sama string di database dia mau mas, kita maunya date, muhun
          Message 4 of 4 , Apr 1, 2009
            --- In netbeans-indonesia@yahoogroups.com, Ifnu bima <ifnubima@...> wrote:
            >
            > > while (rs.next()){
            > > tab.addRow(new Object[]{rs.getString("nama"),rs.getString("tgllhr")});
            > > // Ini tidak tampil di tabel karena field tgllhr tipe datanya date
            >
            > ya jelas salah donk, tipe tgllhr kan date, trus diambil menggunakan getString.
            >
            > tab.addRow(new Object[]{rs.getString("nama"),rs.getDate("tgllhr")});
            >
            >
            >
            >
            > --
            > Senior Engineer @ ArtiVisi Intermedia
            > Java Training Center
            > See our course @ artivisi.com
            >
            > http://ifnu.artivisi.com
            > +62 856 9211 8687
            > regards
            >
            udah pake rs.getDate("tgllhr"), juga gak mau mas, tapi dipe data date diganti sama string di database dia mau mas, kita maunya date, muhun bantuannya.........
          Your message has been successfully submitted and would be delivered to recipients shortly.