日期:2014-05-17  浏览次数:20697 次

急!!ASP问题!怎样读取数据后转存另外一数据表
麻烦帮忙看下下面代码哪里有问题...  
如果答案不方便在此发布可以发到我邮箱best-web@163.com或联系MSN:stone@77itcn.com  


<!---#include   file= "conn.asp "--->  
<%  
set   rs=server.createobject( "adodb.recordset ")  
rs.open   "select   *   from   sdhm ",conn,1,1  
%>  
<%  
if   not   rs.eof   then  
do   while   not   rs.eof  
%>  
<%  
a=rs( "设备号码 ")  
c=rs( "网话费 ")  
d=rs( "市话费 ")  
e1=rs( "国内费用 ")  
e2=rs( "国际费用 ")  
e3=rs( "港澳台长话 ")  
e4=rs( "IP国内费用 ")  
e5=rs( "IP国际费用 ")  
e6=rs( "IP港澳台费 ")  
e=cdbl   (e1)   +   cdbl   (e2)   +   cdbl   (e3)   +   cdbl   (e4)   +   cdbl   (e5)   +   cdbl   (e6)  

'到这里读取和求和完成了,后面的rs.close不知道需要不需要  

rs.close  
%>  

<%  
'这里我是想打开第二个表,然后找号码字段等于变量a的数据,然后将变量写入对应字段  

set   rs2=server.createobject( "adodb.recordset ")  
sqltext= "select   *   from   [号码表]   where   [号码]= "   &   a  
rs2.open   sqltext,conn,3,3  
%>  
<%  
rs2( "网话 ")=c  
rs2( "市话 ")=d  
rs2( "长途 ")=e  
rs2.update  
rs2.close  
'但是好像写不了...  
%>  


<%  
'这里要再次打开下一条匹配记录,再次执行写入  
rs.movenext  
loop  
end   if  
%>  

访问这个程序的时候什么错误提示也没有,所有变量也都可以输出,只是不能转写入另外一个表中的对应字段......   也就是说能读取但没有实现写入


------解决方案--------------------
sqltext= "select * from [号码表] where [号码]= " & a

& a和&a一样吗?
看看是不是这里的问题.....