自用住宅貸款 車貸遲繳多久會拖車 貸款超優惠方案哪間
2016/03/10 11:17
瀏覽21
迴響0
推薦0
引用0
許多人應該被債務或金錢上的問題壓得喘不過氣
往往走上不好的方向高利貸之類的..
今天分享一個好資訊給大家^^
免費諮詢專業人員
最快的時間解決你所遇到問題
解決你個人困難幫助你的問題
各家銀行車貸利率試算房貸整合卡債標題:
jsp程青年房屋貸款率式碼問題
發問:
請問各位大大能解釋下面這一大串是在說什麼嗎?幫我加一下註解,謝謝String query = null; if(data_type.equals("notype")){query = "select indate,datatype,ph,ec,do from mdu_station whe re position_num=3 and station_num = "+station_num +" and indate between to_date('"+timeBegin+"... 顯示更多 請問各位大大能解釋下面這一大串是在說什麼嗎? 幫我加一下註解,謝謝 String query = null; if(data_type.equals("notype")){ query = "select indate,datatype,ph,ec,do from mdu_station whe re position_num=3 and station_num = "+station_num +" and indate between to_date('"+timeBegin+" 00:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('"+timeEnd+" 23:59:59','yyyy-mm-dd hh24:mi:ss') order by indate "; }else{ query = "select indate,datatype,ph,ec,do from mdu_station where position_num=3 and station_num = "+station_num+" and datatype ='"+data_type+"' and indate between to_date('"+timeBegin+" 00:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('"+timeEnd+" 23:59:59','yyyy-mm-dd hh24:mi:ss') order by indate "; } ResultSet rs = stmt.executeQuery(query); while(rs.next()){ String indatetmp=rs.getString("indate"); data_type =rs.getString("datatype"); double phtmp=Double.parseDouble(rs.getString("ph")); double ectmp=Double.parseDouble(rs.getString("ec")); double dotmp=Double.parseDouble(rs.getString("do"));
最佳解答:
這段程式碼的功能是依據使用者輸入的資料,如:data_type、station_num、indate 介於 timeBegin 和 timeEnd 等資料作為查詢條件並執行查詢,之後再將查詢結果取出作相關運用。 //宣告一 java.lang.String 物件 String query = null; //依據 data_type 是否為 notype 決定 SQL 的 WHERE 條件是否要加入 datatype 的限制 if(data_type.equals("notype")){ query = "select indate,datatype,ph,ec,do from mdu_station whe re position_num=3 and station_num = " station_num " and indate between to_date('" timeBegin " 00:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('" timeEnd " 23:59:59','yyyy-mm-dd hh24:mi:ss') order by indate "; }else{ query = "select indate,datatype,ph,ec,do from mdu_station where position_num=3 and station_num = " station_num " and datatype ='" data_type "' and indate between to_date('" timeBegin " 00:00:00',&月利率#039;yyyy-mm-dd hh24:mi:ss') and to_date(&青年創業貸款#039;" timeEnd " 23:59:59','yyyy-mm-dd hh24:mi:ss') order by indate "; } //宣告一 java.sql.ResultSet 物件, //並將執行資料庫查詢後的結果會指定給此物件 ResultSet rs = stmt.executeQuery(query); //因為 rs 的初始狀態是指在第一列資料之前 //所以要取資料時必須使用 rs.next() 將 cursor 下移一筆 //同時 rs.next() 會回傳一布林值告訴你是否有下一筆資料 while(rs.next()){ //使用 rs.getXXX 將查詢結果中各欄位資料取出 String indatetmp=rs.getString("indate"); data_type =rs.getString("datatype"); //java.lang.Double.parseDouble( String str ) 將傳入字串轉成 double double phtmp=Double.parseDouble(rs.getString("ph")); double ectmp=Double.parseDouble(rs.getString("ec")); double dotmp=Double.parseDouble(rs.getString("do"));
其他解答:C9287EEA4F0499C0
你可能會有興趣的文章:
限會員,要發表迴響,請先登入




