天天看點

table架構調用js clob字段的使用

 return  "<a href='javascript:show(" + result['id'] + ")'>"+ data.substring(0,20) +"......</a>";

 try {  

        option.setcontent(utiltool.clobtostring((oracle.sql.clob)rs.getclob("content")));

       } catch (exception e) {

        e.printstacktrace();

       }

// 将字clob轉成string類型 

 public static string clobtostring(clob clob) throws sqlexception, ioexception {

  string restring = ""; 

  reader is = clob.getcharacterstream();// 得到流 

  bufferedreader br = new bufferedreader(is); 

  string s = br.readline(); 

  stringbuffer sb = new stringbuffer(); 

  while (s != null) {// 執行循環将字元串全部取出付值給stringbuffer由stringbuffer轉成string 

   sb.append(s); 

   s = br.readline(); 

  } 

  restring = sb.tostring(); 

  return restring; 

 }

繼續閱讀