str=server.HTMLEncode(str)
str=replace(str,"'","")
str=trim(str)
str=replace(str,chr(39),"")
str=replace(str,chr(13),"<br>")
str=replace(str,vbcrlf,"<br>")
ck=str
end function
我很菜,但我很努力!
前两天自己写了一个SQL 转SQL的asp页面,变通一下就可以变成把access的库转成sql的库了. 以下是源代码,除了第二个<%%>之间由原来的打开SQL改成打开ACCESS外,其他基本上没变: <% db="hcxh_Data" 'SQL数据库 Set connold = Server.CreateObject("ADODB.Connection") connstrold="Provider=sqloledb;Data Source=(local);uid=sa;pwd=;database=hcxh" %> <% 'ACCESS数据库hcxh2.mdb set connnew=server.createobject("adodb.connection") connstrnew="driver={microsoft access driver (*.mdb)};dbq="&server.mappath("hcxh2.mdb") connnew.open connstrnew %>
<% connold.Open connstrold sql="select * from sbgl" Set rsold=Server.CreateObject("Adodb.RecordSet") rsold.Open sql,connold,1,1 connnew.open connstrnew j=0 response.Write"正在转换数据库,请等待……" do while not rsold.eof j=j+1 jgh=rsold("wdh") sbmc=rsold("minc") fzr=rsold("fzr") syzt=rsold("syzt") grrq=trim(rsold("grrq")) cd=rsold("cd") ccbh=rsold("ccbh") xh=rsold("xh") dw=rsold("danw") dj=rsold("danj") lb=rsold("leib") bz=rsold("beiz") zc=rsold("zc") exec="insert into qblsbgl(jgh,sbmc,grrq,fzr,syzt,cd,ccbh,xh,dw,dj,lb,bz,zc) values ('"+jgh+"','"+sbmc+"','"+grrq+"','"+fzr+"','"+syzt+"','"+cd+"','"+ccbh+"','"+xh+"','"+dw+"','"+dj+"','"+lb+"','"+bz+"','"+zc+"')" connnew.execute exec rsold.movenext loop rsold.close connold.close connnew.close response.Write "<br>成功转换" response.Write j response.Write "条记录!" %>
[此贴子已经被作者于2005-7-6 23:21:50编辑过]
[此贴子已经被作者于2005-7-9 15:40:57编辑过]