使用ADO连接数据库,在工作站上自己写几个小函数来转。比如下面是ASP中的代码:
<% RSDispatch %>
<!--#INCLUDE FILE="_ScriptLibrary/rs.asp"-->
<SCRIPT LANGUAGE=jscript RUNAT=Server>
var cat = new ActiveXObject("ADOMD.Catalog");
cat.ActiveConnection=Application("cnCube_ConnectionString")
var conn = new ActiveXObject("ADODB.Connection");
conn.CommandTimeout=600;
conn.open(Application("cnDB_ConnectionString"))
var rs = new ActiveXObject("ADODB.Recordset");
var sDTS_Server=Application("cnDTS_Server")
var sDTS_User=Application("cnDTS_User")
var sDTS_Pwd=Application("cnDTS_Password")
var sADO_ConnStr=Application("cnDB_ConnectionString")
function Description()
{
this.SqlServer_SQL=SqlServer_SQL
}
public_description = new Description();
function SqlServer_SQL(sSQL)
{
var data="";
rs=conn.execute(sSQL);
var iCount = rs.Fields.Count;
var i = 0;
data=data+"<fields><fieldname>"
for (i;
i<n;
i++)
{
data=data+"<field"+i+">"+rs.Fields(i).Name+"</field"+i+">"
}
data=data+"</fieldname>";
while(!rs.EOF)
{
data=data+"<fielddata>"
for (i=0;
i<n;
i++)
{
data=data+"<field"+i+">"+rs(i).Value+"</field"+i+">"
}
data=data+"</fielddata>"
rs.MoveNext
}
data=data+"</fields>"
return data;
}
</SCRIPT>