首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

一小段代码. 总出错,是不是因为字符的类型引起的?该如何解决呢

2012-03-19 
一小段代码. 总出错,是不是因为字符的类型引起的?该怎么解决呢!--#includefile conn.asp --%%%ifr

一小段代码. 总出错,是不是因为字符的类型引起的?该怎么解决呢
<!--#include   file= "conn.asp "-->

<%

%>
<%
if   request.QueryString( "action ")= "re "   then
set   rs=server.CreateObject( "adodb.recordset ")
sql   =   "select   *   from   pic   where   sj= "&request.Form( "sj ")
rs.open   sql,conn,1,1
response.Write(rs( "aname "))
end   if  
%>
<form   name= "form1 "   method= "post "   action= "test.asp?action=re ">
    <label>
    <input   name= "sj "   type= "text "   id= "sj ">
    </label>
    <label>
    <input   type= "submit "   name= "Submit "   value= "提交 ">
    </label>
</form>


为什么总是提示
至少一个参数没有被指定值

就是sql语句那行

所有的字段,我数据库表pic中都有的
不过sj是字符型的,和这个有关系吗?
该怎么解决呢.谢谢先咯.

[解决办法]
试试这样
sql = "select * from pic where sj= ' "&request.Form( "sj ")& " ' "
[解决办法]
不尽是LS这样啊
也可能那是个空值
一进入那个页面时


[解决办法]
SQL语句判断一下,request.Form( "sj ")是否为空
[解决办法]
if len(request.form( "sj "))> 0 then
.......
[解决办法]
conn 对象还没有连接数据库
set conn=server.createobject( "adodb.connection ")
conn.open openstr '连接字符串

热点排行