Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# server.htmledcode在本地主机上工作,但在推送live c时不工作_C#_Sql Server_Decode - Fatal编程技术网

C# server.htmledcode在本地主机上工作,但在推送live c时不工作

C# server.htmledcode在本地主机上工作,但在推送live c时不工作,c#,sql-server,decode,C#,Sql Server,Decode,大约一周前,我问了一个关于Server.HtmlDecodestring的问题。我能够让它在本地主机上正常工作。我把所有的东西都推到了直播网站上,我仍然收到和以前一样的问题。仍存储在SQL数据库中 这是解码文本框字符串并将其插入数据库中新表的代码。同样,当我调试时,这是按预期工作的 private void createInvoiceQueue() { string db = ConfigurationManager.ConnectionStrings["LakeEncroManSys"

大约一周前,我问了一个关于Server.HtmlDecodestring的问题。我能够让它在本地主机上正常工作。我把所有的东西都推到了直播网站上,我仍然收到和以前一样的问题。仍存储在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();
                    }
                }
            }
        }
    }
}

我能够找出我遇到的问题。原来有多个源代码保存,而我推错了源代码。在深入研究网络驱动器和IIS之后,我找到了正确的源代码并推送了修复程序,该程序没有保存HTML字符代码。

不会使用HTMLDecode转换为任何其他内容,因为它不是有效的HTML标记。它缺少尾随分号。另外,由于您在临时查询中使用AddWithValue,您可能想看看本文@SeanLange存储在数据库中。我错过了问题的分号。