˹á
 úҹ
  C/C++ new
  Java new
 Sourcecode.TV
  Android
  Blackberry
  C/C++
  Java
  Linux
  Windows Phone
  ͧͧ
 
  .NET
  Android
  Blackberry
  C++Builder
  Delphi
  Java
  Mobile
  Open Source
  Pocket PC
  Visual Basic
  Web
  Windows Phone
  Others
 Ẻ¹
  ASP
  ASP.NET Webmatrix
  C++
  eVB
  J2ME
  Java
  PHP
 
  Android
  ASP
  C++
  VC++
  CGI-Perl
  Delphi
  Java
  jQuery
  PHP
  Visual Basic
  .NET
 ԡèҡ
  Դ...
  DoodeeHosting
  Ѻ͡Ẻ Ѳ䫵
  Freeware
  ѵҤɳ
  ª١
  ʶԵԼ
 Ŵ
 Ң
 дҹʹ
  .NET
  C/C++
  Delphi
  Java
  Palm/PocketPC
  Visual Basic
  Web
 
 дҹҹ
 ԧ
 ǡѺ
 ѵҤɳ
Social Network

Facebook  Twitter  YouTube
 New Article
 Webboard
 Freelanceboard
Freeware
 (BerDee)
(Android)
駩غ
駩غ(Android)
WebcamMonitor
WebcamMonitor(Windows)
scSendMail
scSendMail(Windows)
MSN Caption
MSN Caption(Windows)
  Freelance comment
  ԴͺʹФѺ...
2015-07-29 13:35:58
  Ҽͧ纷ѲҴ HTML5 ...
2015-01-18 15:33:54
  Ҽͧ纷ѲҴ HTML5 ...
2015-01-18 15:32:51
  ԴͺФѺ
ҹ...

2014-01-06 12:47:38
  ѧҤ͹ ͧ֡ͧ...
2013-07-06 01:04:37
  ʹ觢ͺࢵҤҤҡ͹ФѺ...
2013-03-24 18:54:20
  ѧդѺҹԴѺ 08...
2012-12-16 19:18:14
  ʹ㨤 Դ 0905076277...
2012-11-12 11:07:46
  Ѻ礹ѡ֡ͺѷ
...

2012-10-29 03:10:46
  sukit_te34@hotmail.com...
2012-10-29 03:09:36
  Webboard comment
  Ѻ ͹ matlab ¹ matlab...
2017-06-03 16:27:23
  ੾зҧҴ ͧҢ...
2017-05-25 16:18:08
  ͧ˹Ѻ os ...
2017-05-25 16:12:47
  ¹ php curl ...
2017-04-20 01:04:20
  ¹ ...
2017-03-27 12:50:54
  ʧҷ ͧѾഷ...
2017-03-27 12:37:20
  ͺõͺ...
2017-02-22 13:10:24
  ͧաԸ¹ recursive f...
2017-02-14 13:11:03
  ҡ кͧشҡ...
2017-01-30 11:45:28
  for-loop ͹ѹ
...

2017-01-28 16:00:12
  Homework comment
  ͺسҡѺ...
2017-08-16 18:27:25
  ͧ ͧ ѧ ^^...
2017-04-18 18:40:46
  ͧ ͧ ѧ ^^...
2017-04-18 18:37:54
  á flowchart ѹ...
2017-04-18 17:43:33
  ҡ flowchart ...
2017-04-18 16:25:29
  kungking ӶäѺ ?...
2017-03-18 23:28:36
  ¹ʴͧ...
2017-03-06 10:56:25
  鴷ӧҹẺ ...
2016-09-06 01:00:12
  ҡҺ鴹Ѻѧ...
2016-09-05 09:31:27
  ͧ֡¹...
2016-04-22 00:47:49
  Article comment
  [b]
2017-08-11 22:39:58
  [b]
...

2017-08-11 14:46:33
  ҨѺ ͧ
...

2017-07-11 09:59:35
  ö͡Ѻ anycast ...
2017-07-05 10:12:35
  Ѻ س "Դ" ͧ֡...
2016-06-18 15:21:09
  vs2008 c# Ѻ ͺسѺ...
2016-06-17 14:39:30
  vs c# ӵآ鹵͹...
2016-06-17 14:37:44
  ͧѺ "Ҩԧ ...
2016-03-12 23:36:05
  觢ͤǧ LAN ੾Ф...
2016-03-12 18:25:42
  Terminal Mac ...
2016-02-16 11:02:01
  9Mcode comment
  ҡ...
2014-02-21 08:52:19

Link Exchange

ѵҤɳ
Statistics of Sourcecode in Thailand
 
 Webboard

- - - - - - - - - - - - - - ʹѺʹع- - - - - - - - - - - - - -

з #3533 [Java]

úǹ´䢵ç˹֧͹Ѻ

package com.java.myapp;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;

public class MyDetail extends JDialog {


/**
* Create the dialog.
*/
public MyDetail(final String sid) {
setTitle("Customer_nresu");
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setBounds(100, 100, 760, 550);
getContentPane().setLayout(null);
setResizable(false);

// Header Customer Detail
JLabel hCustomerAdd = new JLabel("Insert Customer");
hCustomerAdd.setBounds(144, 21, 132, 14);
getContentPane().add(hCustomerAdd);

//*** Header ***//
JLabel hid = new JLabel("id :");
hid.setBounds(100, 51, 89, 20);
getContentPane().add(hid);

JLabel hname = new JLabel("name :");
hname.setBounds(100, 81, 120, 20);
getContentPane().add(hname);

JLabel haddress = new JLabel("address :");
haddress.setBounds(100, 111, 89, 20);
getContentPane().add(haddress);

JLabel htel = new JLabel("tel :");
htel.setBounds(100, 141, 89, 20);
getContentPane().add(htel);

JLabel hEmail = new JLabel("Email :");
hEmail.setBounds(100, 171, 89, 20);
getContentPane().add(hEmail);

JLabel htxtregister_of_commercial_No = new JLabel("register of commercial No. :");
htxtregister_of_commercial_No.setBounds(100, 201, 200, 20);
getContentPane().add(htxtregister_of_commercial_No);

JLabel hcapital_investment = new JLabel("capital of register :");
hcapital_investment.setBounds(100, 231, 150, 20);
getContentPane().add(hcapital_investment);

JLabel hǧԹ = new JLabel("ǧԹ :");
hǧԹ.setBounds(100, 261, 89, 20);
getContentPane().add(hǧԹ);

JLabel hsellid = new JLabel("sellid :");
hsellid.setBounds(100, 291, 89, 20);
getContentPane().add(hsellid);

//*** Detail ***//
JLabel lblid = new JLabel("Id");
lblid.setBounds(257, 51, 89, 20);
getContentPane().add(lblid);

JLabel lblname = new JLabel("lblName");
lblname.setBounds(257, 81, 200, 20);
getContentPane().add(lblname);

JLabel lbladdress = new JLabel("lblAddress");
lbladdress.setBounds(257, 111, 400, 20);
getContentPane().add(lbladdress);

JLabel lbltel = new JLabel("lblTel");
lbltel.setBounds(257, 141, 100, 20);
getContentPane().add(lbltel);

JLabel lblEmail = new JLabel("lblEmail");
lblEmail.setBounds(257, 171, 150, 20);
getContentPane().add(lblEmail);

JLabel lblregister_of_commercial_No = new JLabel("lblRegisty of commercial No.");
lblregister_of_commercial_No.setBounds(257, 201, 100, 20);
getContentPane().add(lblregister_of_commercial_No);

JLabel lblcapital_investment = new JLabel("lblCapital investment");
lblcapital_investment.setBounds(257, 231, 150, 20);
getContentPane().add(lblcapital_investment);

JLabel lblǧԹ = new JLabel("lblǧԹ");
lblǧԹ.setBounds(257, 261, 120, 20);
getContentPane().add(lblǧԹ);

JLabel lblsellid = new JLabel("lblsellid");
lblsellid.setBounds(257, 291, 120, 20);
getContentPane().add(lblsellid);

//*** Bind Data ***//
Connection connect = null;
Statement s = null;

try {
Class.forName("com.mysql.jdbc.Driver");

connect = DriverManager.getConnection("jdbc:mysql://localhost/history" +
"?user=root&password=027434323");

s = connect.createStatement();

String sql = "SELECT * FROM customer_nresu " +
"WHERE id = '" + sid + "' ";

ResultSet rec = s.executeQuery(sql);

if(rec != null) {
rec.next();
lblid.setText(rec.getString("Id"));
lblname.setText(rec.getString("Name"));
lbladdress.setText(rec.getString("Address"));
lbltel.setText(rec.getString("Tel"));
lblEmail.setText(rec.getString("Email"));
lblregister_of_commercial_No.setText(rec.getString("Register_of_commercial_No"));
lblcapital_investment.setText(rec.getString("Capital_investment"));
lblǧԹ.setText(rec.getString("ǧԹ"));
lblsellid.setText(rec.getString("Sellid"));
}
rec.close();

} catch (Exception e) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, e.getMessage());
e.printStackTrace();
}

try {
if(s != null) {
s.close();
connect.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println(e.getMessage());
e.printStackTrace();
}




// Close Button
JButton btnClose = new JButton("Close");
btnClose.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});

btnClose.setBounds(400, 400, 69, 23);
getContentPane().add(btnClose);
JButton btnEdit = new JButton("Edit");
btnEdit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
UpdateForm();

}

private void UpdateForm(){



setTitle("Customer_nresu");
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setBounds(100, 100, 760, 550);
getContentPane().setLayout(null);
setResizable(false);

// Header Customer Update
JLabel hCustomerUpdate = new JLabel("Customer Update");
hCustomerUpdate.setBounds(144, 21, 132, 20);
getContentPane().add(hCustomerUpdate);

// *** Header ***//
JLabel hid = new JLabel("ID :");
hid.setBounds(100, 51, 89, 20);
getContentPane().add(hid);

JLabel hname = new JLabel("Name :");
hname.setBounds(100, 81, 89, 20);
getContentPane().add(hname);

JLabel haddress = new JLabel("Address :");
haddress.setBounds(100, 111, 89, 20);
getContentPane().add(haddress);

JLabel htel = new JLabel("Tel :");
htel.setBounds(100, 141, 89, 20);
getContentPane().add(htel);

JLabel hemail = new JLabel("Email :");
hemail.setBounds(100, 171, 89, 20);
getContentPane().add(hemail);

JLabel hregister_of_commercial_No = new JLabel("registy of commercial No. :");
hregister_of_commercial_No.setBounds(100, 201, 89, 20);
getContentPane().add(hregister_of_commercial_No);

JLabel hcapital_investment = new JLabel("capital :");
hcapital_investment.setBounds(100, 231, 89, 20);
getContentPane().add(hcapital_investment);

JLabel hǧԹ = new JLabel("ǧԹ :");
hǧԹ.setBounds(100, 261, 89, 20);
getContentPane().add(hǧԹ);

JLabel hsellid = new JLabel("Sellid :");
hsellid.setBounds(100, 291, 89, 20);
getContentPane().add(hsellid);


final JLabel txtid = new JLabel("id");
txtid.setBounds(207, 51, 99, 20);
getContentPane().add(txtid);


final JTextField txtname = new JTextField("");
txtname.setBounds(207, 81, 99, 20);
getContentPane().add(txtname);

final JTextField txtaddress = new JTextField("");
txtaddress.setBounds(207, 111, 99, 20);
getContentPane().add(txtaddress);

final JTextField txttel = new JTextField("");
txttel.setBounds(207, 141, 99, 20);
getContentPane().add(txttel);


final JTextField txtemail = new JTextField("");
txtemail.setBounds(207, 171, 99, 20);
getContentPane().add(txtemail);


final JTextField txtregister_of_commercial_No = new JTextField("");
txtregister_of_commercial_No.setBounds(207, 201, 99, 20);
getContentPane().add(txtregister_of_commercial_No);


final JTextField txtcapital_investment = new JTextField("");
txtcapital_investment.setBounds(207, 231, 99, 20);
getContentPane().add(txtcapital_investment);


final JTextField txtǧԹ = new JTextField("");
txtǧԹ.setBounds(207, 261, 99, 20);
getContentPane().add(txtǧԹ);

final JTextField txtsellid = new JTextField("");
txtsellid.setBounds(207, 291, 99, 20);
getContentPane().add(txtsellid);


Connection connect = null;
Statement s = null;


try {
Class.forName("com.mysql.jdbc.Driver");

connect = DriverManager
.getConnection("jdbc:mysql://localhost/history"
+ "?user=root&password=027434323");

s = connect.createStatement();

String sql = "SELECT * FROM customer_nresu " + "WHERE id = '"
+ sid + "' ";

ResultSet rec = s.executeQuery(sql);

if (rec != null) {
rec.next();
txtid.setText(rec.getString("ID"));
txtname.setText(rec.getString("Name"));
txtaddress.setText(rec.getString("Address"));
txttel.setText(rec.getString("Tel"));
txtemail.setText(rec.getString("email"));
txtregister_of_commercial_No.setText(rec.getString("register_of_commercial_No"));
txtcapital_investment.setText(rec.getString("capital_investment"));
txtǧԹ.setText(rec.getString("ǧԹ"));
txtsellid.setText(rec.getString("Sellid"));
}
rec.close();

} catch (Exception e) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, e.getMessage());
e.printStackTrace();
}

try {
if (s != null) {
s.close();
connect.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println(e.getMessage());
e.printStackTrace();


}

// Save Button
JButton btnSave = new JButton("Save");
btnSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
SaveData(txtid.getText(), txtname.getText(),
txtaddress.getText(),txttel.getText(),
txtemail.getText(),txtregister_of_commercial_No.getText(),
txtcapital_investment.getText(), txtǧԹ.getText(),
txtsellid.getText());

dispose();
}
});
btnSave.setBounds(131, 400, 69, 23);
getContentPane().add(btnSave);

// Button Close
JButton btnClose = new JButton("Close");
btnClose.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
btnClose.setBounds(217, 400, 69, 23);
getContentPane().add(btnClose);

}



// Update
private void SaveData(String strid, String strname, String straddress,String stremail, String strtel,
String strregister_of_commercial_No, String strcapital_investment, String strǧԹ, String strsellid) {

Connection connect = null;
Statement s = null;

try {
Class.forName("com.mysql.jdbc.Driver");

connect = DriverManager.getConnection("jdbc:mysql://localhost/history" +
"?user=root&password=027434323");

s = connect.createStatement();

String sql = "UPDATE customer_nresu " +
"SET ID = '" + strid + "' " +
", Name = '" + strname + "' " +
", Address = '" + straddress + "' " +
", Tel = '" + strtel + "' " +
", Email = '" + stremail + "' " +
", register_of_commercial_No = '" + strregister_of_commercial_No +"' " +
", capital_investment = '" + strcapital_investment + "' " +
", ǧԹ = '" + strǧԹ + "' " +
", Sellid = '" + strsellid + "' " +
" WHERE ID = '"+strid+"' ";
s.execute(sql);

JOptionPane.showMessageDialog(null, "Record Update Successfully");

} catch (Exception e) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null, e.getMessage());
e.printStackTrace();
}

try {
if(s != null) {
s.close();
connect.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println(e.getMessage());
e.printStackTrace();
}

}
});
btnEdit.setBounds(280, 400, 69, 23);
getContentPane().add(btnEdit);

}
}
ҡس : Jii / gotji26000@gmail.com [2014-11-26 10:32:13]  

58.11.98.241 Դ #29169 (ҡ IP: 58.11.98.241)
Ѻ͹
ҡ͡¡ǹ ͧ֡Ҿǡ MVC Ҩ·ҹ
ҡس : maddog [2014-11-26 18:01:59]
ͺз
´

- - - - - - - - - - - - - - ʹѺʹع- - - - - - - - - - - - - -

 
 
µͨ Ѻͧ macbook pro 2016 (usb-c to HDMI)
µͨ Ѻͧ macbook pro 2016 (usb-c to HDMI) ´дѺ 4K
ŧ Mini DisplayPort to HDMI Adapter ŧ Mini DisplayPort to HDMI Adapter Ѻͧ macbook air/pro, mac mini
ŧ Mini DisplayPort to HDMI Adapter Ѻͧ macbook air/pro, mac mini
µٿѧ Ъ Ѻ iPhone 7  7 Plus
µٿѧ Ъ Ѻ iPhone 7 7 Plus
ŧҡ USB-C Type  USB 3.1 Ѻ MacBook
ŧҡ USB-C Type USB 3.1 Ѻ MacBook
䢤ǧѺͧ Macbook Air/Pro
䢤ǧ Ѻͧ Macbook Air/Pro (300ҷ)
HDMI  3 ͡  1
HDMI 3 ͡ 1 (350ҷ)
Ի͹¹
¹¹ͷ
¹¹͹´
¹¹
¹¹ վʾ
¹¹
¹ҹԹء
¹¹Թ⿹
¹¹Ϊ ʤ
9M Blog ͧ͡ ¹ͧ
ԡ ҾѺԭ
OrmSin.com: ˹ѧͧҹ--չ (country crafts)
ѵҤɳ
 
Tutorial
eVB Tutorial
ASP.NET Webmatrix Tutorial
J2ME Tutorial
C++  Tutorial
Java  Tutorial
PHP Tutorial
ASP Tutorial
 
ẺǨ
Freelance ѺѲ

Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us

ʧǹԢԷ Ѵ͡ ӫ Ѵŧ ٻẺ Ѻ͹حҵѡɳѡ
Ţ¹ҳԪ硷͹ԡҡзǧҳԪ: 7100503002000
Copyright 2001 SourceCode.in.th