📄 50c1eb86ab50001d1dc6bad43998f314
字号:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
class markMess2 extends JFrame implements ActionListener
{ Button button1,button3,button4;
TextField text1,text2,text3;
Label label1,label2,label3;
TextArea text;
markMess2(String s)
{
super(s);
setLayout(new FlowLayout());
text=new TextArea(10,33);
button1=new Button("修改");
//button2=new Button("确定");
button3=new Button("添加");
button4=new Button("删除");
label1 =new Label("学号");
add(label1);
label2 =new Label("课程名");
add(label2);
label3 =new Label("分数");
add(label3);
add(text);
add(button1);
//add(button2);
add(button3);
add(button4);
button1.addActionListener(this);
// button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setBounds(120,120,300,300);
setVisible(true);
validate();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==button1){
Connection con;
Statement sql;
ResultSet rs;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(ClassNotFoundException k){
System.out.println(""+k);
}
try{
con=DriverManager.getConnection("jdbc:odbc:sun","","");
sql=con.createStatement();
String name,key,newkey,delstr,recode;
delstr="DELETE FROM login WHERE name = '" + name+ "'";
System.out.println(delstr);
sql.executeUpdate(delstr);
con.close();
}catch(SQLException ee){
System.out.print(ee);
}
}
}
/*public class MmessageManage
{ public static void main(String args[])
{ markMess2 win=new markMess2("成绩管理") ;
}
}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -