快捷搜索:  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();

}

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: