关于ASP中删除记录的问题,请大神们帮我看看,谢谢啦 怎么显示错误了,index.asp可以正常运行
<%ifrequest.Form("txtname")<>""andrequest.Form("txttel")<>""thendimID,strname,strsex,...
<%
if request.Form("txtname")<>" " and request.Form("txttel")<>" " then
dim ID,strname,strsex,intage,strtel,stremail,strintro
ID=request.Form("txtID")
strname=request.Form("txtname")
strsex=request.Form("rdosex")
if request.Form("txtage")<>" " then
intage=request.Form("txtage")
else
intage=0
end if
strtel=request.Form("txttel")
stremail=request.Form("txtemail")
strintro=request.Form("txtintro")
dim conn,strconn
set conn=server.CreateObject("ADODB.Connection")
strconn="Driver={Microsoft Access Driver (*.mdb)};Dbq=" & server.MapPath("address.mdb")
conn.open strconn
dim strsql
strsql="Update tbaddress set strname='" & strname & "',strsex='" & strsex & "',intage='" & intage & ",strtel='" & strtel & "',stremail='" & stremail & "',strintro='" & strintro & "' where ID=" & ID
conn.execute(strsql)
response.Redirect "index.asp"
else
response.Write "姓名和电话必须填写"
response.Write "<a href='index.asp'>重新填写</a>"
end if
%> 展开
if request.Form("txtname")<>" " and request.Form("txttel")<>" " then
dim ID,strname,strsex,intage,strtel,stremail,strintro
ID=request.Form("txtID")
strname=request.Form("txtname")
strsex=request.Form("rdosex")
if request.Form("txtage")<>" " then
intage=request.Form("txtage")
else
intage=0
end if
strtel=request.Form("txttel")
stremail=request.Form("txtemail")
strintro=request.Form("txtintro")
dim conn,strconn
set conn=server.CreateObject("ADODB.Connection")
strconn="Driver={Microsoft Access Driver (*.mdb)};Dbq=" & server.MapPath("address.mdb")
conn.open strconn
dim strsql
strsql="Update tbaddress set strname='" & strname & "',strsex='" & strsex & "',intage='" & intage & ",strtel='" & strtel & "',stremail='" & stremail & "',strintro='" & strintro & "' where ID=" & ID
conn.execute(strsql)
response.Redirect "index.asp"
else
response.Write "姓名和电话必须填写"
response.Write "<a href='index.asp'>重新填写</a>"
end if
%> 展开
1个回答
展开全部
没有显示你那儿要删除啊,你用的是更新语句
追问
哦,问错了,就是更新语句
追答
先注意自己的字段设置情况,只有字符型的才用单引号。数值型的就不用单引号了。另外如果在sex你先用了布尔型的如像只能用零和一,记不太清了。你可以,一个一个往里面写,然后到到那一个加不进去了,就是那个的问题。比如先写strsql="Update tbaddress set strname='" & strname & "' where ID=" & ID看能不能,如果行,再加一个strsql="Update tbaddress set strname='" & strname & "',strsex='" & strsex & "' where ID=" & ID依次往后写,看问题出在那儿了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询