ASP简单查询代码问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 19:25:14
以下代码,运行有部分字段显求为空.请各位大虾指教.
<%
textT=request("textT")
textT=request.form("textT")
sql="select * from khdd where ddID='"&textT&"'"
set rs=conn.execute(sql)
if rs.eof then
response.write("对不起.没有相关订单记录")
else
%>
<table width="100%" border="1" cellspacing="0" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF"style='FONT-SIZE: 9pt'>
<tr>
<td width="12%" align="right" bgcolor="#FFFFCC">客户名称:</td>
<td width="21%" align="left"><%=rs("khmc")%></td>
<td width="14%" align="right" bgcolor="#FFFFCC">收款日期:</td>
<td width="26%" align="left"><%=rs("skrq")%></td>
<td width="27%&

你在
sql="select * from khdd where ddID='"&textT&"'"
后面加一行
response.write sql
看看打印出来的是什么
然后你把那个打印出来的语句在数据库里面查一下看有没有这条数据
你的ddID如果是数字的,SQL就改成
sql="select * from khdd where ddID="&textT

还有,前面干嘛这样写?
textT=request("textT")
textT=request.form("textT")
直接一个textT=request("textT")不就好了吗??

那是你有的字段值是空的,所以才如此,好好检查你字段看看