请问大家一个问题!!

daddygirlqiuwf 2002-02-02 09:54:05
大家一定知道,指示用数据库组件获得数据库查询结果的程序。
我想问的问题是,如果在删除是,我想控制在另外一个表“QWF_USER_YHXXB"中有此用户的记录就不能删除,它们直接的联系是它们都有一个username的字段,我应怎么样控制呢?
先在这里谢谢大家了!!

package data1;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.dx.sql.dataset.*;
import com.borland.dbswing.*;
import com.borland.dx.dataset.*;

public class Frame1 extends JFrame {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
Database database1 = new Database();
QueryDataSet queryDataSet1 = new QueryDataSet();
JdbNavToolBar jdbNavToolBar1 = new JdbNavToolBar();
JdbStatusLabel jdbStatusLabel1 = new JdbStatusLabel();
TableScrollPane tableScrollPane1 = new TableScrollPane();
JdbTable jdbTable1 = new JdbTable();

/**Construct the frame*/
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**Component initialization*/
private void jbInit() throws Exception {
//setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
contentPane = (JPanel) this.getContentPane();
queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "select * from QWF_CLERK_YGXXB", null, true, Load.ALL));
database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:oracle:thin:@wg039:1521:grade98", "exercise", "exercise", false, "oracle.jdbc.driver.OracleDriver"));
contentPane.setLayout(borderLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Frame Title");
jdbStatusLabel1.setText("jdbStatusLabel1");
jdbTable1.setDataSet(queryDataSet1);
contentPane.add(jdbNavToolBar1, BorderLayout.NORTH);
contentPane.add(jdbStatusLabel1, BorderLayout.SOUTH);
contentPane.add(tableScrollPane1, BorderLayout.CENTER);
tableScrollPane1.getViewport().add(jdbTable1, null);
}
/**Overridden so we can exit when window is closed*/
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
}
...全文
7 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复

还没有回复,快来抢沙发~

发帖
非技术区
创建于2007-09-28

2.3w+

社区成员

Java 非技术区
申请成为版主
帖子事件
创建了帖子
2002-02-02 09:54
社区公告
暂无公告