请问大家一个问题!!

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);
}
}
}
...全文
46 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

23,404

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧