写入数据库问题,求助
数据库中有三张表,在接受三个表单的数据时,一个能写如数据库。另外两个却写不进
程序的代码是基本相同的不知怎么办?
如下:<!--#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%>