在输入资产信息时,我是想在窗体中单击下拉框(jComboBox1)选择下面的内容,所以写了下面代码,但是保存后没有在数据库表中显示。我怀疑是代码写错了但又不知道如何改。请各位高手帮忙。
String h="";
int sta = jComboBox1.getSelectedIndex();
switch(sta){
case 1:
c = "正常";
break;
case 2:
c = "维修";
break;
case 3:
c = "报废";
break;
case 4:
c = "停用";
break;
case 5:
c = "借出";
break;
case 6:
c = "领用";
break;
}
String h="";
int sta = jComboBox1.getSelectedIndex();
switch(sta){
case 1:
c = "正常";
break;
case 2:
c = "维修";
break;
case 3:
c = "报废";
break;
case 4:
c = "停用";
break;
case 5:
c = "借出";
break;
case 6:
c = "领用";
break;
}
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.*;/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class dataconnection extends JFrame {
BorderLayout borderLayout1 = new BorderLayout();
private Connection con;//定义数据源的连接引用
Statement strm ;
public dataconnection() { } public void opensql() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException ex1) {
System.out.println(ex1);
}
try {
con = DriverManager.getConnection("jdbc:odbc:test","sa","");
strm = con.createStatement();
System.out.println("connection is success!!");
} catch (SQLException ex) {
System.out.println(ex);
}
}
}
情況掉了