日期:2014-05-17  浏览次数:20739 次

asp 导出excel 中又遇到的个一个棘手的问题问题
<%response.contenttype= "application/vnd.ms-excel "%>
<%set   conn=server.createobject( "adodb.connection ")
conn.open   "dsn=list;uid=sa;pwd=1111 "
set   rs=sever.cteateobject( "adodb.recordset ")
sql= "select   *   from   list   where   出生日期= ' "&   request.form( "生日 ")   & " ' "
rs.open   sql,conn,1,1%>
<table   border=1>
<tr>
…………
    <td> <%=rs( "姓名 ")%> </td>    
    <td> <%=rs( "身份证号 ")%> </td>
…………
</tr>
</table>
生成excel
但是我的发现这里的   request.form( "生日 ")的值为空,不知该怎么将这个数值传递到这个   sql中.请高手指点,我急用.谢谢!

------解决方案--------------------
If request.form( "生日 ") = " " Then
sql= "select * from list where 出生日期 Is Null "
Else
sql= "select * from list where 出生日期= ' "& request.form( "生日 ") & " ' "
End If

与数据库字段设置有关

------解决方案--------------------
request.querystring( "生日 ")
------解决方案--------------------
xx=request( "生日 ")
还是名字写错了?
还是用英文吧
------解决方案--------------------
如果要通过 request.form 来获得 生日的值 ,那就要从上一个页面或父页面的 表单中提交过来。并且,在那个表单中要有一个 name 或 id 为 "生日 "的 控件(text之类的),所以建议用英文来设置 name 或id 值
------解决方案--------------------
看来你是值没有获取到啊!
你不妨改字段名为英文试试看,有的时候就是因为对中文支持的不够好,才导致将简单的问题变的复杂化