新手问题...关于JB返回SQL数据的问题!
返回比tt= "ygp ";
返回的也是rs.getString(1)= "ygp ";
运行结果为:
ygp
ygp
java.sql.SQLException: No data found
为什么这个语句不能成立:if(rs.getString(1).equals(tt))
package mythsoftcorporation;
import java.awt.BorderLayout;
import java.awt.*;
import java.util.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
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 Frame2 extends JFrame {
JPanel contentPane;
Icon j2=new ImageIcon( "../图片/tp1.JPG ");
JLabel d1 = new JLabel(j2);
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JPasswordField t2 = new JPasswordField();
JComboBox t1 = new JComboBox();
String tt= " ";
String yy= " ";
public Frame2() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws
java.lang.Exception */
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(null);
setSize(new Dimension(330, 270));