我对web dev非常新鲜,但我正在整理一个带有经典ASP的简单软件目录.一切似乎都很好,除了我想在页面上两次使用我的SQL数据库中的值.例如,在页面标题和页面正文中,但我似乎只能使用每个值一次:
.... Set nItem = Request.QueryString("ID") strSQL = "SELECT * "_ & "FROM [Packages] "_ & "WHERE id='" & nItem & "';" Set rstSearch = cnnSearch.Execute(strSQL)<%=rstSearch.Fields("Software") %> Software Information <%=rstSearch.Fields("Software")%>
<%=rstSearch.Fields("Version")%>
<%=rstSearch.Fields("ID")%>
<%=rstSearch.Fields("Licence")%>
...
Wayne Molina.. 5
将其分配给变量; 不要只从Recordset中提取值.
Set nItem = Request.QueryString("ID") strSQL = "SELECT * "_ & "FROM [Packages] "_ & "WHERE id='" & nItem & "';" Set rstSearch = cnnSearch.Execute(strSQL) Dim software software = rstSearch("Software") ' set your other fields as variables...<%= software %> Software Information <%= software %>
应该适合你.
将其分配给变量; 不要只从Recordset中提取值.
Set nItem = Request.QueryString("ID") strSQL = "SELECT * "_ & "FROM [Packages] "_ & "WHERE id='" & nItem & "';" Set rstSearch = cnnSearch.Execute(strSQL) Dim software software = rstSearch("Software") ' set your other fields as variables...<%= software %> Software Information <%= software %>
应该适合你.