热爱asp的女孩求助! 数据库问题

risker1981417 2003-08-24 09:31:20
数据库有三张表,分别接受两张表单的内容和一个留言板的内容
为什么只有留言板的内容写得进数据库,而表单的数据都不能写
入数据库,真是奇怪,代码都是差不多的应该不会有错。请指点!
...全文
25 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
risker1981417 2003-08-25
  • 打赏
  • 举报
回复
上面的方法都试过了还是没有用,那位大哥帮忙看看,asp代码和sql都调试过了没有问题,就是两张表单的数据写不进数据库。急死了!
jianming98 2003-08-25
  • 打赏
  • 举报
回复
我觉得与rs的游标类型,和锁定类型有关,你最好在执行addnew前先定义rs的这两个类型,不过将记录插入数据库,用addnew会降低速度,用command命令直接执行sql语句,效率会更高
ahuiok 2003-08-24
  • 打赏
  • 举报
回复
同意楼上试试。

另外看看数据库里, 有没有不允许为空的字段。

再看看有没有拼写错误的单词?
formatkm 2003-08-24
  • 打赏
  • 举报
回复
request.form只接受post提交的表单,你的提交可能是get。
你可以把conn1,3 改成conn3,3试试
risker1981417 2003-08-24
  • 打赏
  • 举报
回复
表单不是用request.form("控件名称")吗,表单数据可以提出,但就是写不进数据库啊,讨厌死了
54duke 2003-08-24
  • 打赏
  • 举报
回复
社会风气够... 这里.... 真....
lwzlemon 2003-08-24
  • 打赏
  • 举报
回复
表单用request("控件名称")来提取数据,呵呵,比你还菜
risker1981417 2003-08-24
  • 打赏
  • 举报
回复
<!--#include file="dbconn.asp"-->
<!--#include file="char.asp"-->
<%
sub getInput()
sName=request.form("txtcustname")
sSex=request.form("sltcustsex")
sPwd=request.form("txtcustpwd")
sAddr=request.Form("txtcustaddr")
sPhone=request.form("txtcustphone")
sEmail=request.Form("txtcustemail")

end sub

dim rs
dim sName
dim sSex
dim sPwd
dim sAddr
dim sPhone
dim sEmail
dim errorMsg
dim foundError


getInput()
saveData()
if foundError=false then
response.redirect "notebook.asp"
else
call showerrors()
end if
set rs=nothing
conn.close
set conn=nothing



sub saveData()
dim InsertCursor
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
InsertCursor.Open "select * from customer",conn,1,3
InsertCursor.addnew
InsertCursor("custacct")=""
InsertCursor("custname")=htmlencode(sName)
InsertCursor("custsex")=htmlencode(sSex)
InsertCursor("custpwd")=htmlencode(sPwd)
InsertCursor("custaddr")=htmlencode(sAddr)
InsertCursor("custphone")=htmlencode(sPhone)
InsertCursor("custemail")=htmlencode(sEmail)
InsertCursor("time") =cstr(date())
InsertCursor.Update
InsertCursor.close
conn.close
set InsertCursor=nothing
if err>0 then
err.clear
foundError=true
ErrorMsg="<li>数 据 库 操 作 失 败 !</li>"
else
foundError=false
end if
end sub
sub showErrors()
%>
<html>

<head>
<title>发现错误</title>
</head>

<body bgcolor="#666666">
<p align="center">数据库操作错误!</p>

<p align="center"><span style="font-size: 9pt"><%=ErrorMsg%></span> </p>
</body>
</html>
<%end sub%>
benben0443 2003-08-24
  • 打赏
  • 举报
回复
这个,你能把相关代码帖出来吗?
上面的说明不了问题!

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧