一次提交,插入多条记录这可能吗,大家给我出出主意。
a库有记录,姓名:张三,电话号码:138xxxx,133xxxxx,010XXXXX   
 也就是说电话号码字段里用逗号分开的多个号码。   
 然后读出来写到b库里,将电话号码分开,每个号码一条记录,如: 
 姓名:张三,电话号码:138xxxx 
 姓名:张三,电话号码:133xxxxx 
 姓名:张三,电话号码:010XXXXX     
 点一次提交按扭可以同时完成写三条记录吗,谢谢,我很菜,用的是dw。查了这个贴子http://topic.csdn.net/t/20021214/23/1261581.html说可以用循环,可我一点看不懂。   
 如果写到b库三条记的同时,再写到原来的a库中ok字段一个ok,表示已转存完。   
 这可能吗,谢谢。
------解决方案--------------------telstr=a( "tel ") 
 tel=split(telstr, ", ")   
 for x=0 to ubound(tel) 
 b.new 
 b( "name ")=a( "name ") 
 b( "tel ")=tel(x) 
 b.update 
 next   
 a.close 
 b.close 
------解决方案--------------------落了一句 
 在next后面加 
 a( "ok ")= "ok " 
 a.update
------解决方案--------------------b.new应该是b.newadd吧
------解决方案--------------------用DW我也不会,因为我一直是自己手写的 
 这个问题我同意大家意见,用split()和循环 
 简单例子: 
 tel=request.form( "tel ") 
 tel2=split(tel, ", ") 
 for i=0 to ubound(tel2) 
 if tel2(i)= " " then exit for  '有这句意味着表单必须按顺序填写,否则遇到空值就退出循环 
 conn.execute( "insert into 表 (telephone) values( ' "&tel2(i)& " ') ") 
 next
------解决方案--------------------create table table_a 
 ( 
 name varchar(10), 
 tel varchar(100) 
 ) 
 insert table_a select  'zhangsan ', ',136,137,138 ' 
 union all select  'zhangsanxx ', ',131,132,133 '   
 select * from table_a where name= 'hangsan '   
 create table table_b(id int) 
  select top 100 identity(int,1,1) as id into table_b from a,b 
 select * from table_b   
 select table_a.name,substring(table_a.tel,table_b.id+1,3) from table_a,table_b 
 where table_a.name= 'zhangsan ' and substring(table_a.tel,table_b.id,1)= ', '
------解决方案--------------------晕,楼上的代码~~~~DW害人的说   
 a库有记录,姓名:张三,电话号码:138xxxx,133xxxxx,010XXXXX   
 也就是说电话号码字段里用逗号分开的多个号码。   
 然后读出来写到b库里,将电话号码分开,每个号码一条记录,如: 
 姓名:张三,电话号码:138xxxx 
 姓名:张三,电话号码:133xxxxx 
 姓名:张三,电话号码:010XXXXX 
 rs.open  "select [tel],name from a ",conn,1,1 
 do while not rs.eof  
 tel=split(rs( "tel "), ", ") 
 for i=0 to ubound(tel) 
 conn.execute( "insert into b (name,tel) values ( ' "&rs( "name ")& " ', ' "&tel(i)& " ') ") 
 next 
 rs.movenext 
 loop
------解决方案--------------------同意楼上,代码上面的写了好多,鉴于楼主是新手,推荐这段代码: 
 tel=request.form( "tel ") 
 tel2=split(tel, ", ") 
 for i=0 to ubound(tel2) 
 if tel2(i)= " " then exit for  '有这句意味着表单必须按顺序填写,否则遇到空值就退出循环 
 conn.execute( "insert into 表 (telephone) values( ' "&tel2(i)& " ') ") 
 next   
 任何东西要自己写写,报错不是问题,慢慢就会很熟练
------解决方案--------------------declare @s varchar(8000)  
 set @s = '2219,2220,223 ' 
 declare @t table([int] int) 
 while charindex( ', ',@s)> 0  
 begin 
 insert @t select cast(left(@s,charindex( ', ',@s)-1) as int) 
 select @s = stuff(@s,1,charindex( ', ',@s), ' ') 
 end 
 if len(@s)> 0 
 insert @t select cast(@s as int)