I need help I am getting a constant blank page when connecting to a database in classic asp. I have changed some of the connection string for security purposes. I know this string works because I can connect to it in vb.net.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search Test</title>
</head>
<body>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Data Source=ServerIP;Initial Catalog=Database;User ID=Username;Password=Password"
strSql = "SELECT * FROM categories Where idParentcategory=1 ORDER BY categorydesc ASC"
Set rs = Conn.Execute(strSql)
If rs.eof Then
Response.write("No records returned")
End If
do until rs.eof
Response.write(rs("categorydesc") & "<br>")
rs.movenext
loop
Conn.Close
Set Conn = Nothing
%>
</body>
</html>
If it’s showing a blank page, is it possible you have an
on error resume nextwe can’t see (maybe it’s in an include file)?I would handle this by checking for
eofand then only looping through the resultset if it is not empty.This isn’t really different from @03Usr’s answer except: