以下代码仅能实现单个数据库的添加,不能同时添加进几个数据库表!另外我按照楼上的说法试了一下还是不得啊!各位看看还有什么好的方法可以实现吗?请指教! '打开本地数据表********************************** 'request("checkbox")为取得复选框信息articleid;request("office")为取得复选框值科室值:office set rs=server.CreateObject("adodb.recordset") sql="select * from news_article where articleid="&request("checkbox") rs.open sql,conn,1,1 content=rs("content") title=rs("title") classid=rs("classid") nkey=rs("nkey") hits=rs("hits") dateandtime=rs("dateandtime") writer=rs("writer") writefrom=rs("writefrom") state=rs("state") author=rs("author") disptime=rs("dateandtime") rs.close set rs=nothing set conn=nothing '判断并打开其他数据库********************************** dim office office=request("office") office=split(office,",") for i=0 to UBound(office) if i=0 then cjf=Trim(office(i)) else cjf=cjf+","+Trim(office(i)) end if next select case cjf case 0 Set conn = Server.CreateObject("ADODB.Connection") conn.open "DRIVER={SQL Server};SERVER=192.168.168.5;DATABASE=jckoffice;UID=sa;PWD=" case 1 Set conn = Server.CreateObject("ADODB.Connection") conn.open "DRIVER={SQL Server};SERVER=192.168.168.6;DATABASE=sljszk;UID=sa;PWD=" case 2 Set conn = Server.CreateObject("ADODB.Connection") conn.open "DRIVER={SQL Server};SERVER=192.168.168.7;DATABASE=building;UID=sa;PWD=" case 3 Set conn = Server.CreateObject("ADODB.Connection") conn.open "DRIVER={SQL Server};SERVER=BILL\CXDY3;DATABASE=SZJCZD;UID=sa;PWD=" case 4 Set conn = Server.CreateObject("ADODB.Connection") conn.open "DRIVER={SQL Server};SERVER=BILL\CXDY3;DATABASE=SZJCZD;UID=sa;PWD=" end select set rs=server.CreateObject("adodb.recordset") sql="select * from news_article" rs.open sql,conn,2,3 rs.addnew rs("content")=content rs("title")=title rs("classid")=classid rs("nkey")=nkey rs("hits")=hits rs("dateandtime")=dateandtime rs("writer")=writer rs("writefrom")=writefrom rs("state")=state rs("author")=author rs.update
rs.close set rs=nothing set conn=nothing
[此贴子已经被作者于2005-1-4 9:46:42编辑过]