c# - XML解析错误

标签 c# asp.net

尝试在 C# 中的 Web 应用程序中实现下载功能时出现 XML 解析错误。相同的代码在另一个网络表单中工作。

SqlConnection cn = new SqlConnection();

cn.ConnectionString =ConfigurationManager.ConnectionStrings["cn"].ConnectionString.ToString();
cn.Open();

String abc = null;

SqlCommand cm = new SqlCommand("select User_ID from Mgmt where S_Name='" + DropDownList1.Text + "'", cn);

SqlDataReader dr = cm.ExecuteReader();

if (dr.Read())
{
    abc = dr.GetString(0).ToString();
}

dr.Close();
cm.Dispose();

String ab = null;

SqlCommand cmd = new SqlCommand("select Result from Result where Clg_ID='" + abc + "'and Student_ID='" + TextBox1.Text + "'", cn);
SqlDataAdapter drr = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();

drr.Fill(ds);

ab = ds.Tables[0].Rows[0][0].ToString();

Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename='"+ab+"'");
Response.TransmitFile(Server.MapPath("~/Result/"+ab));
Response.End();

cn.Close();

最佳答案

经过大量努力,我为自己的问题找到了可能的答案。这不是一个准确的答案。我刚换了我的电脑,然后这个错误就没有了,回到我以前的电脑时,错误也得到了解决。我仍然不知道导致错误的原因以及如何解决它。

关于c# - XML解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13910234/

相关文章:

c# - 如何以编程方式为单个应用程序设置多个身份验证 cookie

javascript - 使用 Javascript 启用验证器

asp.net - ASP.Net Core Web Api 中的异步视频流无法正常工作

asp.net - Sharepoint WebPart 中 Silverlight 控件的客户端 ID

c# - 序列化一个 BigInteger

c# - 带有奇怪字符的 ASP.NET CSV Excel 问题

c# - 如何阻止创建多个 ViewModel

c# - 在 Moq 上使用与 UserManager 的接口(interface)

c# - ASP.NET Web API 属性路由 : RoutePrefix with Route Parameter

c# - 在 AspNet WebApi 帮助页面中生成模型描述