代码如下:学生管理系统实现删除时,为什么总是报错,就打红字那行,不知道是哪错了,求指教
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;import javax.swing.*;import java.util.*;
import java.sql.*;public class text2 extends JFrame implements ActionListener {
JScrollPane jsp1;
JPanel jp1, jp2;
JLabel jl1;
JTextField jtf1;
JButton jb1, jb2, jb3, jb4;
JTable jt1;
ScrollPane sp1;
stumodel s1;  String className = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String url = "jdbc:sqlserver://localhost:1433;databasename=stu";
Connection ct = null;
PreparedStatement ps = null;
String username = "钱俊模";
String password = "qjm315110"; public static void main(String[] args) {
// TODO Auto-generated method stub
text2 t2 = new text2();
} public text2() {
jl1 = new JLabel("用户名");
jtf1 = new JTextField(10);
jb1 = new JButton("查询");
jp1 = new JPanel(); jb1.setActionCommand("查询");
jb1.addActionListener(this); jp2 = new JPanel();
jb2 = new JButton("添加");
jb2.setActionCommand("添加");
jb2.addActionListener(this); jb3 = new JButton("修改");
jb3.setActionCommand("修改");
jb3.addActionListener(this);

jb4 = new JButton("删除");
jb4.setActionCommand("删除");
jb4.addActionListener(this); stumodel sm = new stumodel();
jt1 = new JTable(sm);
jsp1 = new JScrollPane(jt1); jp1.add(jl1);
jp1.add(jtf1);
jp1.add(jb1); jp2.add(jb2);
jp2.add(jb3);
jp2.add(jb4); this.add(jp1, BorderLayout.NORTH);
this.add(jp2, BorderLayout.SOUTH);
this.add(jsp1); this.setSize(400, 300);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub

if (e.getActionCommand().equals("查询")) {
String name = this.jtf1.getText().trim();
String sql = "select *from stu where stuname='" + name + "'";
s1 = new stumodel(sql);
jt1.setModel(s1); } else if (e.getActionCommand().equals("添加")) {
AddstuDialog asd1 = new AddstuDialog(this, "添加数据", true);
s1 = new stumodel();
jt1.setModel(s1);


else if (e.getActionCommand().equals("删除")) {
int rownum = this.jt1.getSelectedRow();

if (rownum == -1) {
JOptionPane.showMessageDialog(this, "请选择一行");
return ;

String stuNo=(String)s1.getValueAt(rownum, 0);

System.out.println(stuNo);
try {
Class.forName(className);
ct = DriverManager.getConnection(url);
ps = ct.prepareStatement("delete from stu where stuno=?");
ps.setString(1, stuNo);
ps.executeUpdate();

} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}finally{
try {
if(ps!=null) ps.close();
if(ct!=null) ct.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
s1 = new stumodel();
jt1.setModel(s1);
}
else if(e.getActionCommand().equals("修改"))
{
int rownum=this.jt1.getSelectedRow();
if(rownum==-1)
{
JOptionPane.showMessageDialog(this, "请选择一行");
return;
}
setstuDialog s2=new setstuDialog(this,"修改学生数据",true,s1,rownum);
}
}
}