标题:在asp中添加数据,在sql中找不到数据
只看楼主
xzlixun
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-10
 问题点数:0 回复次数:3 
在asp中添加数据,在sql中找不到数据


<!--#include file="conn.asp"-->
<%
xh=request.form("xh")
xm=request.form("xm")
cym=request.form("cym")
bj=request.form("bj")
xb=request.form("xb")
mz=request.form("mz")
jg=request.form("jg")
zzmm=request.form("zzmm")
csny=request.form("csny")
sxzy=request.form("sxzy")
xz=request.form("xz")
xl=request.form("xl")
pymb=request.form("pymb")
syd=request.form("syd")
yhtc=request.form("yhtc")
sf=request.form("sf")
sf=request.form("sf")
dianhua=request.form("dianhua")
dzyx=request.form("dzyx")
bz=request.form("bz")
conn.exec="INSERT
INTO stuinfo
VALUES
("+xh+",'"+xm+"','"+cym+"','"+bj+"','"+xb+"','"+mz+"','"+jg+"','"+zzmm+"','"+csny+"','"+sxzy+"','"+xz+"','"+xl+"','"+pymb+"'
'"+syd+"','"+yhtc+"','"+sf+"','"+dianhua+"','"+dzyx+"','"+bz+"')
conn.execute exec
conn.close
set conn=nothing
response.redirect "welcome.asp"
%>
这个是conn.asp
<%
dim asconn
set asconn=server.createobject("adodb.connection")
asconn.open = "provider=SQLOLEDB.1;data source=XZLIXUN;"&_
"initial catalog=DB;user id=sa;password=sa;"
function encodestr(str)
str=trim(str)
str=replace(str,"<","&lt;")
str=replace(str,">","&gt;")
str=replace(str,"""","'")
str=replace(str,vbCrLf&vbCrlf,"</p><p>")
str=replace(str,vbCrLf,"<br>")
encodestr=replace(str," ","")
end function
function cutstr(tempstr,tempwid)
if len(tempstr)>tempwid then
cutstr=left(tempstr,tempwid)&"..."
else
cutstr=tempstr
end if
end function '限制新闻标题的显示字数的函数,后面以...显示

function astext(vstrin) '字符编码
dim i,strreturn
strreturn = ""
for i = 1 to len(vstrin)
thischr = mid(vstrin,i,1)
if abs(asc(thischr)) < &hff then
strreturn = strreturn & thischr
else
innercode = asc(thischr)
if innercode < 0 then
innercode = innercode + &h10000
end if
hight8 = (innercode and &hff00)\ &hff
low8 = innercode and &hff
strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8)
end if
next
astext = strreturn
end function
%>

搜索更多相关主题的帖子: file include sql asp 
2007-05-10 18:57
lq7350684
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:5089
专家分:98
注 册:2006-11-6
得分:0 
conn.exec="INSERT
INTO stuinfo
VALUES
("+xh+",'"+xm+"','"+cym+"','"+bj+"','"+xb+"','"+mz+"','"+jg+"','"+zzmm+"','"+csny+"','"+sxzy+"','"+xz+"','"+xl+"','"+pymb+"'
'"+syd+"','"+yhtc+"','"+sf+"','"+dianhua+"','"+dzyx+"','"+bz+"')
改成
conn.exec="INSERT
INTO stuinfo
VALUES
("+xh+",'"+xm+"','"+cym+"','"+bj+"','"+xb+"','"+mz+"','"+jg+"','"+zzmm+"','"+csny+"','"+sxzy+"','"+xz+"','"+xl+"','"+pymb+"'
'"+syd+"','"+yhtc+"','"+sf+"','"+dianhua+"','"+dzyx+"','"+bz+"')"
2007-05-11 08:52
xzlixun
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-10
得分:0 

还是不行


2007-05-11 18:19
xzlixun
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-5-10
得分:0 

谢谢!


2007-05-11 21:30



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-138328-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.062080 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved