写入数据库问题,求助

risker1981417 2003-08-22 05:41:07
数据库中有三张表,在接受三个表单的数据时,一个能写如数据库。另外两个却写不进
程序的代码是基本相同的不知怎么办?

如下:<!--#include file="dbconn.asp"-->
<!--#include file="char.asp"-->
<%
dim gName
dim gSex
dim gPwd
dim gser
dim gLug
dim gSerCty
dim gAge
dim gHeight
dim gCity
dim rs
dim errorMsg
dim foundError

sub getInput()
gName=request.Form("txtgidname")
gSex=request.Form("sltgidsex")
gPwd=request.Form("txtgidpwd")
gser=request.Form("sltgidservice")
gLug=request.Form("txtgidlaug")
gSerCty=request.Form("txtgidsercity")
gAge=request.Form("txtgidage")
gHeight=request.Form("txtgidheight")
gCity=request.Form("txtgidcity")
end sub

getInput()
saveData()
if foundError=false then
response.redirect "notebook.asp"
else
call showerrors()
end if

conn.close
set conn=nothing
sub savedata()
set rs=server.CreateObject("ADODB.Recordset")
rs.open "Select * from guide",conn,1,3
rs("gidacct")=""
rs("gidname")=htmlencode(gName)
rs("gidsex")=htmlencode(gSex)
rs("gidpwd")=htmlencode(gPwd)
rs("gidservice")=htmlencode(gser)
rs("gidlaug")=htmlencode(gLug)
rs("gidsercity")=htmlencode(gSerCty)
rs("gidage")=htmlencode(gAge)
rs("gidheight")=htmlencode(gHeight)
rs("gidcity")=htmlencode(gCity)
rs("gidtime")=cstr(now())
rs.update
rs.close
conn.close
set rs=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">数据库操作出错<span style="font-size: 9pt">!</span></p>
<p align="center"><span style="font-size: 9pt"><%=ErrorMsg%></span> </p>
</body>
</html>
<%end sub%>
...全文
70 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
数据库设置 看看

检查数据库各个字段 和代码是否一样

risker1981417 2003-08-24
  • 打赏
  • 举报
回复
没有错啊,就是写不进
fuzq 2003-08-23
  • 打赏
  • 举报
回复
在哪句出错?

28,390

社区成员

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

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