我正在尝试使用数据库计数验证固定长度的文件计数,当它与计数匹配时,pass 语句不会在 if 语句中执行,但是它将转到 else 语句。任何方向都会被应用。
以下是我的代码:
static String ubservicesCount = "";
String connectionUrl = "jdbc:sqlserver://"+strpServer+":"+strpPort+";databaseName="+strpDatabase+";IntegratedSecurity=true";
// Declare the JDBC objects.
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection(connectionUrl);
String SQL = strpQuery5+Qt+ProcessID+Qt;
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
while (rs.next()) {
ubservicesCount = rs.getString(1);
System.out.println("UB servicesCount is " +ubservicesCount);
}
String st;
BufferedReader Br = null;
File objFile = new File(strPlanFile+NewFileNmae);
Br = new BufferedReader(new FileReader(objFile));
List<String> list = new ArrayList<String>();
while ((st = Br.readLine()) != null) {
String arraylist = st;
String RcdType = arraylist.substring(0, arraylist.length()-392);
list.add(RcdType);
执行后,它在我的报告中的 else 语句中打印失败。我调试了哪里可以看到在比较语句中它与计数匹配。我不确定我在这里缺少什么。
哆啦的时光机
相关分类