调用第一个文档的内容无关紧要,始终使用此代码将其从列表中排除。我可以对数据库运行相同的选择语句并显示正确的结果。我想我只是看了太多代码而没有看到问题。
SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DBName"].ToString());
objConn.Open();
string sTSQL =
"SELECT [filename] " +
"FROM [DB].[dbo].[secure_files] ";
SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
objCmd.CommandType = CommandType.Text;
SqlDataReader dr = objCmd.ExecuteReader();
dr.Read();
html += "<ul>";
while (dr.Read())
{
html += "<li><a href=\"/secure/secureDownload.aspx?query=" + dr[0].ToString() + "\">" + dr[0].ToString() + "</a></li>";
}
html += "</ul>";
objConn.Close();