ASP提交页面报错

来源:百度知道 编辑:UC知道 时间:2024/05/28 10:04:24
<html>
<head>
<title> 提交页面</title>
</head>
<%
db="test.mdb"//数据库
Set Conn=Server.CreateObject("adodb.Connection")
Conn_Str="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
Conn.Open Conn_Str
Set IRS=Server.CreateObject("adodb.recordset")
sql="select * from [user]"
IRS.Open sql,Conn,1,3
%>
<table width="767" height="303" border="1">
<tr>
<td colspan="2" align="center">写入数据</td>
</tr>
<form action="?action=insert" method="post" name="insertdata">
<tr>
<td align="right">用户名:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td align=

<%
if Request("action")="insert" then

IRS.AddNew
IRS("username")=Request("username")
IRS("password")=Request("password")
IRS.Update
IRS.Close
Set IRS=nothing
Response.Write "<script>alert('添加成功!');javascript:location.href='index.asp';</script>"
end if
%>

最后<%%>的语句,我想你是用if 来判断是否要提交表单的吧.
Request("action")="insert" then 这行要加个 if 不然只有 then可不行.

还要补一个 end if在结尾.