| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 863 人关注过本帖
标题:[求助]看看哪的毛病
只看楼主 加入收藏
xiapi
Rank: 1
等 级:新手上路
威 望:2
帖 子:305
专家分:0
注 册:2006-10-11
收藏
 问题点数:0 回复次数:6 
[求助]看看哪的毛病

有两段代码我个人感觉差不多,而且都是对同一个表进行修改,第一段可以正常的运行,第二段不能更改数据库里的数据。我找不出是哪的错,请大家帮我看看!

第一段
<!--#include file="top.asp"-->
<%colxr=request("colxr")
colxrsex=request("colxrsex")
cotelq=request("cotelq")
cotel=request("cotel")
cofaxq=request("cofaxq")
cofax=request("cofax")
mail=request("mail")
coyb=request("coyb")
coaddress=request("coaddress")
colxother=request("colxother")
Oicq=request("Oicq")

if cofax<>"" or cofaxq<>"" then
if cofaxq="" or cofax="" or len(cofaxq)<3 or len(cofax)<7 then
errstyle="·请输入正确的传真及区号!"
scripterr
end if
end if
if coyb<>"" then
if len(coyb)<>6 or IsNumeric(coyb)=0 then
errstyle="·请输入正确的所在地区邮编!"
scripterr
end if
end if

if cofaxq="" then cofaxq=null
if cofax="" then cofax=null
if coyb="" then coyb=null
if colxother="" then colxother=null
if Oicq="" then Oicq=null

set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from xp_mt where MT_id="&session("id")
rs.open sql,conn,1,3
rs("MT_lxr")=colxr
rs("MT_lxrsex")=colxrsex
rs("MT_telq")=cotelq
rs("MT_tel")=cotel
rs("MT_faxq")=cofaxq
rs("MT_fax")=cofax
rs("MT_email")=mail
rs("MT_zip")=coyb
rs("MT_address")=coaddress
rs("MT_lxother")=colxother
rs("MT_key")=cityypkey
rs("MT_qq")=Oicq
rs.update
rs.close
set rs=nothing

session("mtname")=""

if cityypkey=1 then
response.redirect"ok.asp?url=lcdlx.asp"
elseif cityypkey=0 then
response.redirect"ok.asp?url=lcdlx.asp&key=yes"
end if%>

[此贴子已经被作者于2006-10-12 9:56:09编辑过]

搜索更多相关主题的帖子: request 数据库 毛病 Oicq 
2006-10-12 09:37
xiapi
Rank: 1
等 级:新手上路
威 望:2
帖 子:305
专家分:0
注 册:2006-10-11
收藏
得分:0 

=====================================================
以下是第二段
<!--#include file="top.asp"-->
<%ypxxone_id=request.Form("ypxxone_id")
addone_id=request.Form("addone_id")
addtwo_id=request.Form("addtwo_id")

ypxxone_id_=request.Form("ypxxone_id_")
addone_id_=request.Form("addone_id_")
addtwo_id_=request.Form("addtwo_id_")

if ypxxone_id="" then
ypxxone_id=ypxxone_id_
end if
if addone_id="" then
addone_id=addone_id_
addtwo_id=addtwo_id_
end if

coname=request.Form("coname")
coy=request.Form("coy")
coweb=request.Form("coweb")
codate=request.Form("codate")
wkh=request.Form("wkh")
nkh=request.Form("nkh")
coms=request.Form("coms")
zhubian=Request.Form("zhubian")
zhuguan=request.Form("zhuguan")
shezhang=request.Form("shezhang")
zhuban=request.Form("zhuban")
chuban=request.Form("chuban")
fanwei=request.Form("fanwei")
dingjia=Request.Form("dingjia")
logo=request.Form("logo")
yppic=request.Form("yppic")
yfdh=Request.Form("yfdh")

set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from xp_mt where MT_id="&session("id")
rs.open sql,conn,1,3
rs(" mt_title")=coname
rs(" mt_etilte")=coy
rs(" mt_web")=coweb
rs(" mt_cldate")=codate
rs(" mt_wkh")=wkh
rs(" mt_nkh")=nkh
rs(" mt_jj")=coms
rs(" mt_zhubian")=zhubian
rs(" mt_zhuban")=zhuban
rs(" mt_zhuguan")=zhuguan
rs(" mt_shezhang")=shezhang
rs(" mt_chuban")=chuban
rs(" mt_fw")=fanwei
rs(" mt_dingjia")=dingjia
rs(" mt_pic")=yppic
rs(" mt_logo")=logo
rs(" mt_yfdh")=yfdh
rs(" mt_ypxxone_id")=ypxxone_id
rs(" mt_addone_id")=addone_id
rs(" mt_addtwo_id")=addtwo_id
rs(" mt_key")=cityypkey
rs.Update
rs.Close
set rs=nothing
session("mtname")=""

if cityypkey=1 then
response.redirect"ok.asp?url=lcdzl.asp"
elseif cityypkey=0 then
response.redirect"ok.asp?url=lcdzl.asp&key=yes"
end if

%>

两段代码都是对同一个表,第一段可以更改数据
第二段不能更改数据,字段都是正确的。
不知道怎么回事,请大家帮看看


没有什么能够阻挡,我对自由的向往,天马行空的生涯一颗心了无牵挂。
2006-10-12 09:38
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
request与request.form以及request.querystring的区别与用法问题

request是通用的,包括post 与 get 的值都可以取

request.form只取表单通过post过来的值

request.querystring只取get过来的值,比如
http://bbs.bc-cn.net/viewthread.php?tid=95741
中的boardID就可通过其来取到

http://www./
2006-10-12 09:57
xiapi
Rank: 1
等 级:新手上路
威 望:2
帖 子:305
专家分:0
注 册:2006-10-11
收藏
得分:0 
我的表单都是post过来的,我验证过request("")取的数据不为空,数据库中也允许空字符串,反正这些语句都执行了就是数据库没有反应。

没有什么能够阻挡,我对自由的向往,天马行空的生涯一颗心了无牵挂。
2006-10-12 10:01
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
有什么提示?

还有就是
sql="select * from xp_mt where MT_id="&session("id")
中的session("id")有没有过期?

以及
rs(" mt_title")=coname
rs(" mt_etilte")=coy
rs(" mt_web")=coweb
..

这些前面的空格不知道有没有影响,我是没有试过
你可以试一下
rs("mt_title")=coname 把前面的空格去掉看看?



http://www./
2006-10-12 10:09
xiapi
Rank: 1
等 级:新手上路
威 望:2
帖 子:305
专家分:0
注 册:2006-10-11
收藏
得分:0 
提示“修改成功”,但其实没有成功!(是不是和我开玩笑!)
session(“id”)没有过期,已经验证过了。
空格已经去掉了!
已经试过了conn.execute("update 表名 set 字段名='"&变量&"'")的方法,也不行!

[此贴子已经被作者于2006-10-12 11:17:39编辑过]


没有什么能够阻挡,我对自由的向往,天马行空的生涯一颗心了无牵挂。
2006-10-12 10:15
xiapi
Rank: 1
等 级:新手上路
威 望:2
帖 子:305
专家分:0
注 册:2006-10-11
收藏
得分:0 
各位还有没有什么好的提示!

没有什么能够阻挡,我对自由的向往,天马行空的生涯一颗心了无牵挂。
2006-10-12 11:19
快速回复:[求助]看看哪的毛病
数据加载中...
 
   



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

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