数据仍然读取"在httpuitility.htmldecode()之后

时间:2016-07-15 09:42:36

标签: c# asp.net http

正在阅读的数据中仍有",即使我放了HttpUtility.HtmlDecode() 功能我该如何解决这个问题?图片如下 image of problem 和代码如下所示

string quer = "SELECT Date_Issued, quantity, Unit from Issuance_Consumables where Model = '"+ HttpUtility.HtmlDecode(model.ToUpper())+"' AND Branch = '"+ branch.ToUpper()+"' AND Dept = '"+ dept.ToUpper()+"' AND Company  = '"+company.ToUpper()+"' AND BU = '"+ bu.ToUpper()+"' AND Section = '"+section.ToUpper()+"'";

try
{
    connUs.Open();
    reads.CommandText = quer;
    readers = reads.ExecuteReader();
}
catch(System.Exception)
{
    //
}

while(readers.Read())
{
    dateissue = readers.GetDateTime(0).ToShortDateString();
    quantity = readers.GetDecimal(1).ToString();
    unit = readers.GetString(2);
}

gvModal.Rows[y].Cells[9].Text = dateissue;
gvModal.Rows[y].Cells[10].Text = quantity;
gvModal.Rows[y].Cells[11].Text = unit;

0 个答案:

没有答案