?
快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

和記娛棒h88285:數據庫作為tree數據源

?

自己寫的動態tree,自己先留著備用,假如和記娛棒h88285想用請下載個blazeds

===========mxml段代碼============

===============java端代碼==================

package com.qx.biz;

import java.io.DataInputStream;

import java.io.File;

import java.io.FileInputStream;

import java.io.InputStream;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import com.qx.ut和記娛棒h88285il.XmlUtil;

public class DemoBiz {

private static final String driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver";

private static final String conStr="jdbc:sqlserver://localhost:1433;databaseName=Demo";

private static final String user="sa";

private static final String pwd="ok";

public Connection getConn(){

Connection con=null;

try {

Class.forName(driverName);

con=DriverManager.getConnection(conStr,user,pwd);

} catch (Exception e) {

e.getMessage();

}

return con;

}

public String queryXML(){

Connection con=this.getConn();

ResultSet rs=null;

S和記娛棒h88285tring sql="select * from SysFun";

String a="";

try {

PreparedStatement pst=con.prepareStatement(sql);

rs=pst.executeQuery();

a=XmlUtil.convertResultSetToXML2(rs);//自定義result結果集轉化成xml款式

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();和記娛棒h88285

}

return a;

}

}

============XmlUtil措施=======

public static String convertResultSetToXML2(ResultSet rs) {

StringBuffer sb = new StringBuffer();

try {

ResultSetMetaData rsmd = rs.getMetaData();

if (rsmd.getColumnCount() >= 0)

sb.append("\n");

sb.append("\t\n");

for (; rs.next(); sb.append("")) {

sb.append(

(new StringBuilder("\t\t\n");

}

sb.append("\t\n");

sb.append("\n");

} catch (Exception e) {

e.printStackTrace();

}

return sb.和記娛棒h88285toString();

}

免責聲明:以上內容源自網絡,版權歸原作者所有,如有侵犯您的原創版權請告知,我們將盡快刪除相關內容。

您可能還會對下面的文章感興趣:

快三平台开户