import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JButton;import javax.swing.JTextField;import javax.swing.JList;import javax.swing.DefaultListModel;import javax.swing.JScrollPane;import java.awt.BorderLayout;import java.sql.DriverManager;import java.sql.Connection;import java.sql.Statement;import java.sql.ResultSet;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;public class KS extends JFrame implements ActionListener{private JPanel pan=new JPanel();private JTextField jtf=new JTextField();private DefaultListModel dlm=new DefaultListModel();private JList list=new JList(dlm);private JScrollPane jsp=new JScrollPane(list);private JButton but1=new JButton("获得信息");private JButton but2=new JButton("修改信息");private Connection conn;private Statement st;private ResultSet rs;public KS(){pan.add(but1);pan.add(but2);but1.addActionListener(this);but2.addActionListener(this);this.getContentPane().setLayout(new BorderLayout());this.getContentPane().add(jsp,BorderLayout.CENTER);this.getContentPane().add(pan,BorderLayout.SOUTH);this.setSize(400,300);this.setVisible(true);}public static void main(String [] args){JFrame.setDefaultLookAndFeelDecorated(true);new KS();}public void actionPerformed(ActionEvent e){if(e.getSource()==but1){try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");conn=DriverManager.getConnection("jdbc:odbc:Northwind");st=conn.createStatement();String str []=null;rs=st.executeQuery("select ProductName,UnitPrice from Products ");while(rs.next()){str[0]=rs.getString(1);str[1]=rs.getString(2);dlm.addElement(str[0]+":"+str[1]);}}catch (Exception ex){}}}}库是系统的Northwind 库,数据源是 Northwind里的价钱是money型的 我怎么获得出来
參考答案:while(rs.next()){rs.getString("UnitPrice ");}