-
why i can not update the data after edit
Hi all
Tell me, why i can not update data, after i edit record by selected the record in a table. Thanls a lot
btn.btnEdit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int response;
response=JOptionPane.showConfirmDialog(null,"Update a Category - Are you sure? ","",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if(response==JOptionPane.YES_NO_OPTION)
{
buildObjectCat();
objBodtCat.updateRecord(objClsCat);
}
}
});
cat.jRadByAll.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
sql="select * from category ";
tab.jtable=objBodtCat.searchAll(sql);
tab.jsPane=new JScrollPane(tab.jtable);
displayTable();
}
});
public void displayTable()
{
if (tab.getComponentCount() != 0)
tab.removeAll();
tab.add(tab.jsPane);
tab.jtable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListSelectionModel rowSM=tab.jtable.getSelectionModel();
rowSM.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e)
{
JOptionPane.showMessageDialog(null,"Testing Table row: ","Seach",JOptionPane.INFORMATION_MESSAGE);
ListSelectionModel lsm=(ListSelectionModel)e.getSource();
showSelectedRow(lsm);
}
});
validate();
}
private void showSelectedRow(ListSelectionModel lsm)
{
int selectedRow =lsm.getMinSelectionIndex();
int numCols = tab.jtable.getColumnCount();
System.out.println("Display: "+numCols);
TableModel model=tab.jtable.getModel();
String stCatNo=model.getValueAt(selectedRow,0)+"";
String stCatDes=model.getValueAt(selectedRow,1)+"";
cat.jtfCategoryNo.setText(stCatNo);
cat.jtfDescription.setText(stCatDes);
// buildObjectCat();
}
Similar Threads
-
By Terry in forum ASP.NET
Replies: 3
Last Post: 03-11-2003, 05:00 PM
-
By Naveen Thalanki in forum VB Classic
Replies: 0
Last Post: 09-17-2001, 03:03 PM
-
By Chuck Owen in forum VB Classic
Replies: 1
Last Post: 04-11-2001, 08:13 PM
-
By vidhya in forum VB Classic
Replies: 0
Last Post: 08-23-2000, 01:23 AM
-
By Dan in forum VB Classic
Replies: 0
Last Post: 03-17-2000, 05:14 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks