从数据库取值

来源:百度知道 编辑:UC知道 时间:2024/05/14 14:52:38
我想从已有的数据库表中取值,不知道下面这段代码问题出在哪?希望高手帮个忙,谢谢!
<%
set rs=server.createobject("adodb.recordset")

sql="select * from SMT_yp where SMT_id="&id
rs.open sql,conn,1,1
%>
<table width='420' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td height='100' background='img/about_top.gif'><div style='margin-top:15px;;height:20px;width:100%;line-height:20px;font-weight:bold;font-size:16px;text-align:left;padding-left:130px;margin-bottom:5px;'><%coname%></div><div style='height:20px;line-height:16px;font-size:14px;text-align:left;padding-left:150px;font-weight:bold;padding-top:5px;'><span style='color:#366496'><%rs("SMT_colxr")%></span> <%rs("SMT_colxrsex")%></div></td></tr>
<tr><td height='125' background='

rs("SMT_cotelq) 在这写前面加个=号就好了
<%=rs("SMT_cotelq)%> 其他的都这样

<%%>内要加=
比如
<%=rs("SMT_coaddress")%>

需要连接对象 adodb.connection
像<%rs("SMT_coaddress")%> 的都要改为<%=rs("SMT_coaddress")%>.
最好有释放,关闭连接的代码