关于ASP查询SQL数据库

来源:百度知道 编辑:UC知道 时间:2024/05/11 04:16:26
我想做个查询数据库的用户名是否存在的程序,在输入的全是数字时程序没有错误,但是在查询的字符是字母时,程序就出错。
代码如下:
提交页:
<table width="97%" height="101" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="21"><div align="center">域名查询</div></td>
</tr>
<tr>
<td height="29"><label>请在此查询您喜欢的域名是否被抢注:</label></td>
</tr><form name="checkname" action="reg_check.asp" method="post">
<tr>
<td height="16"><strong>www.</strong>
<label>
<input name="check" type="text" size="8">
<strong> .c5n.cn</strong><input type="submit

set rs=conn.execute(sql) 是错在这句么?如果是的话检查y_user的属性,如果是字符型的,把SQL改成sql="Select * from y_yp where y_user='"& user &"'"
如果是数值型的,那你在查询前要加个isnumeric约束,防止程序出错也好防止SQL恶意注入

你用户名类型是不是int型的,如果是那么字符型就不能查了啊