ASP数组数值插入到ACCESS数据库出现的奇怪问题,希望高手指教~~~
代码如下;db="#2hand.mdb"Setconn=Server.CreateObject("ADODB.Connection")connstr="Provider=...
代码如下;
db="#2hand.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open connstr
'自己写写入数据库循环!
title=""&url_tittle&""
'response.Write "获得的结果是:<br>"&title
title=split(title,"</tr>")'将结果变成数组--关键开始!
for i=0 to ubound(title)
title(i)=replace(title(i),"""","")
title(i)=replace(title(i),"<tr>","")
title(i)=replace(title(i),"<td bgcolor=#FFFFFF>","")
title(i)=replace(title(i),"</td>","/")
title(i)=replace(title(i)," ","")
'response.Write "<br>替换后的结果是:"&title(i)
title2=split(trim(title(i)),"/")
for j=0 to ubound(title2)
title2(j)=trim(title2(j))
response.Write "<br>该组数据分别是:"&title2(j)
next
a=trim(cstr(title2(0)))
' b=trim(cstr(title2(1)))
b=cstr(trim(title2(1)))
c=trim(cstr(title2(2)))
response.Write a&"--<br>"''''''''''''''''''''''''非常奇怪~~~怎么会不能插入到数据库中呢?!!
response.Write b&"<br>"
response.Write c&"<br>"
sql="select * From biao"
rs.open sql,conn,3,3
rs.addnew
rs("ziduan1")=int(a)
rs("ziduan2")=cstr(b)
rs("ziduan3")=cstr(c)
rs("ziduan4")="d"
rs.update
rs.close
'
sql="insert into biao(ziduan1,ziduan2,ziduan3,ziduan4)values("&a&",'"&b&"','"&c&"','d')"
response.Write sql
' ' response.End()
' rs.open sql,conn,1,1
next
插入数据库时候:都是空值!!ziduan1 在不加‘’时候可以增加数值型~~~~
但是怎么也不能把字符型的数组值插入到数据库中~~~~但是明明读的时候能读出来啊~~~~~~~请高手赐教~~~~ 展开
db="#2hand.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open connstr
'自己写写入数据库循环!
title=""&url_tittle&""
'response.Write "获得的结果是:<br>"&title
title=split(title,"</tr>")'将结果变成数组--关键开始!
for i=0 to ubound(title)
title(i)=replace(title(i),"""","")
title(i)=replace(title(i),"<tr>","")
title(i)=replace(title(i),"<td bgcolor=#FFFFFF>","")
title(i)=replace(title(i),"</td>","/")
title(i)=replace(title(i)," ","")
'response.Write "<br>替换后的结果是:"&title(i)
title2=split(trim(title(i)),"/")
for j=0 to ubound(title2)
title2(j)=trim(title2(j))
response.Write "<br>该组数据分别是:"&title2(j)
next
a=trim(cstr(title2(0)))
' b=trim(cstr(title2(1)))
b=cstr(trim(title2(1)))
c=trim(cstr(title2(2)))
response.Write a&"--<br>"''''''''''''''''''''''''非常奇怪~~~怎么会不能插入到数据库中呢?!!
response.Write b&"<br>"
response.Write c&"<br>"
sql="select * From biao"
rs.open sql,conn,3,3
rs.addnew
rs("ziduan1")=int(a)
rs("ziduan2")=cstr(b)
rs("ziduan3")=cstr(c)
rs("ziduan4")="d"
rs.update
rs.close
'
sql="insert into biao(ziduan1,ziduan2,ziduan3,ziduan4)values("&a&",'"&b&"','"&c&"','d')"
response.Write sql
' ' response.End()
' rs.open sql,conn,1,1
next
插入数据库时候:都是空值!!ziduan1 在不加‘’时候可以增加数值型~~~~
但是怎么也不能把字符型的数组值插入到数据库中~~~~但是明明读的时候能读出来啊~~~~~~~请高手赐教~~~~ 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询