动漫少女图片紫色系:ASP按钮代码

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/10 11:42:23
我想点击“确定”按钮,把文本框里的内容插入到SQL数据库的表中。请问该如何写“确定”按钮里的代码。
另外,在插入数据库之前怎样判断文本框里是否有内容?
怎样判断文本框里的内容和数据库里的内容有重复?
相关代码如下:
<!--#include file="../conn.asp"-->
<form id="form1" name="form1" method="post" action="">
<table width="297" height="109" border="1" align="center">
<tr>
<td width="97" height="24">栏目名称</td>
<td width="184"><input name="ColumnName" type="text" id="ColumnName" /></td>
</tr>
<tr>
<td height="25">栏目序号</td>
<td><input name="ColumnOrder" type="text" id="ColumnOrder" /></td>
</tr>
<tr>
<td height="25">表名</td>
<td><input name="TableName" type="text" id="TableName" /></td>
</tr>
<tr>
<td height="23">首页</td>
<td><input name="FirstPage" type="text" id="FirstPage" /></td>
</tr>
</table>

<table width="300" border="0" align="center">
<tr>
<td width="297"><div align="center">
<input type="submit" name="Submit3" value="确定" onclick="??????????????????????"/>
<input type="reset" name="Submit22" value="取消" />
</div></td>
</tr>
</table>
</form>

<!--#include file="../conn.asp"-->
<!--文件conn.asp为连接数据库的代码-->
<form id="form1" name="form1" method="post" action="test.asp">
<!--action表示提交到的标单,暂时定义为 action="test.asp"-->
<table width="297" height="109" border="1" align="center">
<tr>
<td width="97" height="24">栏目名称</td>
<td width="184"><input name="ColumnName" type="text" id="ColumnName" /></td>
</tr>
<tr>
<td height="25">栏目序号</td>
<td><input name="ColumnOrder" type="text" id="ColumnOrder" /></td>
</tr>
<tr>
<td height="25">表名</td>
<td><input name="TableName" type="text" id="TableName" /></td>
</tr>
<tr>
<td height="23">首页</td>
<td><input name="FirstPage" type="text" id="FirstPage" /></td>
</tr>
</table>

<table width="300" border="0" align="center">
<tr>
<td width="297"><div align="center">
<input type="submit" name="Submit3" value="确定" />
<!--onclick为点击确定按钮触发的事件,一般用来检测提交时有无非法字符-->
<input type="reset" name="Submit22" value="取消" />
</div></td>
</tr>
</table>
</form>
'-----------------------------------------
'test.asp
'-----------------------------------------
<!--#include file="../conn.asp"-->
<%
if request.form1("form1")<>"" then '用来判断是否提交表单为空

set rs=server.createobject("adodb.recordset")
sql="select * from 书库表 where 项目1='"&trim(request.form("input标签的名字")&"'"
rs.open sql,conn,3,1
if rs.recordcount>=1 then
reponse.write "有重复项"
end if
else
arert("没有输入")
end if
rs.close
set rs=nothing

%>

ASP还只能把表单里的数据提交到服务器,再由器来处理。
提交至服务器后用INSERT INTO语句写入数据表
如果要验证的话就用SELECT * FROM xxx WHERE 来判断行是否存在。

去找个例子来看还快~~~~~~