我在一周前问了一个关于Server.HtmlDecode(字符串)的问题HtmlDecode。我能够在我的localhost上正常工作。我把所有东西都推到了现场网站上,我仍然遇到了以前遇到过的问题。
仍存储在SQL数据库中。
这是应该解码文本框字符串并将它们插入数据库中的新表的代码。再次,当我正在调试时,这正如预期的那样工作。
private void createInvoiceQueue()
{
string db = ConfigurationManager.ConnectionStrings["LakeEncroManSys"].ConnectionString;
using (SqlConnection conn = new SqlConnection(db))
{
using (SqlCommand querycmd = new SqlCommand("Select Count(*) from tblInvprintqueue", conn))
{
querycmd.Connection.Open();
int sqlResult = (int)querycmd.ExecuteScalar();
querycmd.Connection.Close();
try
{
SqlCommand ExecSP = new SqlCommand("spCreateInvoicePrintQueue", conn);
ExecSP.CommandType = CommandType.StoredProcedure;
ExecSP.Connection.Open();
sdr = ExecSP.ExecuteReader();
while (sdr.Read())
{
lblError.Visible = true;
lblError.Text = "Invoices are being created.";
}
ExecSP.Connection.Close();
}
catch (System.Exception excep)
{
MessageBox.Show(excep.Message);
}
finally
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
GridViewRow row = GridView1.Rows[i];
if (GridView1.Visible)
{
SqlCommand insertInvoice = new SqlCommand("Insert into tblInvPrintQueue ([InvoiceNumber],[EncID],[EncType],[ParcelID],[AmountDue],[DateInvoice],[DateDue],[NumSlips],[FullName],[Addr1],[Addr2],[Addr3],[Note],[PermitYear]) " +
"Values (@InvNum,@EncID,@EncType,@ParcelID,@AmountDue,@DateInv,@DateDue,@NumSlips,@FullName,@Addr1,@Addr2,@Addr3,@Note,@PermitYear)", conn);
insertInvoice.Connection.Open();
insertInvoice.Parameters.AddWithValue("@InvNum", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[0].Text);
insertInvoice.Parameters.AddWithValue("@EncID", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[1].Text);
insertInvoice.Parameters.AddWithValue("@EncType", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[2].Text);
insertInvoice.Parameters.AddWithValue("@ParcelID", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[3].Text);
insertInvoice.Parameters.AddWithValue("@AmountDue", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[4].Text);
insertInvoice.Parameters.AddWithValue("@DateInv", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[5].Text);
insertInvoice.Parameters.AddWithValue("@DateDue", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[6].Text);
insertInvoice.Parameters.AddWithValue("@NumSlips", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[7].Text);
insertInvoice.Parameters.AddWithValue("@FullName", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[8].Text);
insertInvoice.Parameters.AddWithValue("@Addr1", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[9].Text);
insertInvoice.Parameters.AddWithValue("@Addr2", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[10].Text);
insertInvoice.Parameters.AddWithValue("@Addr3", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[11].Text);
insertInvoice.Parameters.AddWithValue("@Note", SqlDbType.NVarChar).Value = Server.HtmlDecode(row.Cells[12].Text);
insertInvoice.Parameters.AddWithValue("@PermitYear", SqlDbType.NVarChar).Value = DateTime.Parse(LeaseYear).Year;
insertInvoice.ExecuteNonQuery();
insertInvoice.Connection.Close();
}
}
}
}
}
}
答案 0 :(得分:0)
我能够弄清楚我遇到的问题。事实证明,源代码有多次保存,我正在推送错误的源代码。在深入了解网络驱动器和IIS之后,我能够找到正确的源代码并推送修复程序,而不是保存HTML字符代码。