求java和sql高手啊、、、本人菜鸟苦闷中!
elseif(e.getSource()==re_collage){Stringstr4=JOptionPane.showInputDialog(this,"输入新信息"...
else if(e.getSource()==re_collage) {
String str4 = JOptionPane.showInputDialog(this,"输入新信息","输入对话框",
JOptionPane.PLAIN_MESSAGE);
try{
stmt = conn.createStatement();
String sql1 = "select * from collage where D_NAME = '"+ str4 + "'";
rs = stmt.executeQuery(sql1);
if (rs.next())
stmt1 = conn.createStatement();
String sql = "update student set D_ID = '"+rs.getString("D_ID")+"' where student.S_ID = '"
+ jtf_num1.getText().trim() + "'";
stmt1.executeUpdate(sql);
JOptionPane.showMessageDialog(null, "修改成功!");
} catch (SQLException e2) {
e2.printStackTrace();
}
}
1 展开
String str4 = JOptionPane.showInputDialog(this,"输入新信息","输入对话框",
JOptionPane.PLAIN_MESSAGE);
try{
stmt = conn.createStatement();
String sql1 = "select * from collage where D_NAME = '"+ str4 + "'";
rs = stmt.executeQuery(sql1);
if (rs.next())
stmt1 = conn.createStatement();
String sql = "update student set D_ID = '"+rs.getString("D_ID")+"' where student.S_ID = '"
+ jtf_num1.getText().trim() + "'";
stmt1.executeUpdate(sql);
JOptionPane.showMessageDialog(null, "修改成功!");
} catch (SQLException e2) {
e2.printStackTrace();
}
}
1 展开
4个回答
展开全部
你想问什么?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
能否说怎么了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看不清,说下问题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询