2013-12-20 13 views
1

首先,我在一個ASP.NET Web-Pages中使用帶有C#環境的WebMatrix,它使用SQL Server Compact(SQL Server CE)。爲什麼WebMatrix在SQL Server CE中使用數據類型ntext嘗試手動編輯長字符串時出錯?(我是否需要SQL編碼)?

我以前從來沒有聽說過需要任何類型的SQL編碼,但在這種情況發生在我身上之後,我想我最好確定(我開始用谷歌搜索「SQL編碼」,雖然我確實得到了一些信息,結果並沒有真正說明我的情況,我認爲):

我有一個數據庫,我試圖保存一個可能的大字符串。在串

agendaLines = $("#agendaText").val().split("\n"); 

它然後通過AJAX發送到服務器使用JSON.stringify(agendaLines)

一旦出現,而且還:

此字符串最初來自於一個HTML <textarea>元素,聚集與jQuery,像這樣表格,我只需要用簡單的INSERT聲明以及一些其他值將INSERT裝入我的數據庫。

這個長字符串插入得很好,沒有錯誤,但問題是,如果我嘗試「手動」(即不在查詢中)對該行執行某種操作,WebMatrix會拋出錯誤(我認爲必須是因爲字符如"[,],;,,或其他可能)。這不是一個真正的問題,因爲我不打算手動編輯或刪除任何行,如果我真的需要我可以使用查詢,這似乎工作正常。但是,它確實讓我非常懷疑,由於某種原因,我是否應該預期未來會出現其他錯誤,數據庫崩潰或未來可能存在的安全漏洞。

這裏是JSON.stringify(agendaLines)輸出:

["A G E N D A ",""," ","","Okmulgee City Council, regular session, Tuesday, December 17, 2013 at 5:00 p.m. in the Council Chambers of City Hall, 111 East Fourth Street, Okmulgee, Oklahoma.",""," ","","CALL TO ORDER"," ","","Roll Call of Members"," ","","Pledge of Allegiance to the Flag of the United States"," ","","Invocation"," ","","MINUTES - Consider and vote to approve with any necessary corrections"," ","","November 19, 2013, special session","November 19, 2013, regular session"," ","","CLAIMS - Consider and vote to approve and authorize payment of such."," ","","COMMUNICATIONS – Not included on the agenda"," ","","ORDER OF BUSINESS"," ","","A) Consider and take action with respect to a resolution of the city council of the city of Okmulgee, Oklahoma (the 「City」) approving the incurrence of indebtedness by the Okmulgee municipal authority (the 「Authority」) issuing its utility system and sales tax revenue note, series 2013 (the 「note」); providing that the organizational document creating the authority is subject to the provisions of the indenture authorizing the issuance of the note; waiving competitive bidding with respect to the sale of the note and approving the proceedings of the authority pertaining to the sale of said note; ratifying and confirming the sales tax agreement by and between the city and the authority pertaining to the year-to-year pledge of certain sales tax revenues; ratifying and confirming the lease agreement, pertaining to the city’s utility systems; and containing other provisions relating thereto.",""," ","","B) Presentation by Joe Prentice concerning damages to the Okmulgee Police Department.",""," ","","C) Consider and vote to approve retirement benefits for Jeremy Porter.",""," ","","D) Consider and vote to adopt an ordinance on standards for oversized loads being trucked through the city in which the standards are all contained in existing state law and/or metro Tulsa ordinances; and declaring an emergency.",""," ","","E) Consider and vote to approve, approve conditionally or disapprove the preliminary plat of Okmulgee Business Complex, a portion of the SE quarter of Section 31, T-14-N, R-13-E, Indian base and meridian Okmulgee County, State of Oklahoma.",""," ","","F) Consider and vote to approve acceptance of a bid for the purchase of two (2) Ford AWD police utility vehicles from the lowest, most responsible bidder and authorize the Mayor and City Clerk to execute the necessary documents.",""," ","","G) Consider and vote to approve a lease Extension for a period of an additional six months on the Eldon Day Lease.",""," ","","H) Consider and possibly both grant and accept the donation of a public utility easement for the City of Okmulgee.",""," ",""," I) Consider and vote to approve the appointment of Jack J. Willis or Brian Priegel to the Planning and Zoning Commission.",""," ","","     J) Consider and vote to approve appointment of a representative of the governing body and an alternate to the Indian Nations Council of Governments (INCOG) Board of Directors.",""," ","","    K) Consider and vote to hold an executive session to discuss the potential hiring of a new Okmulgee City Manager. At the conclusion of the executive session, the Council will reconvene to take such action as may be useful or appropriate to hire or appoint a new City Manager, change the proposed benefit package, or eliminate individual candidates from the applicant pool as they deem useful. Authority for an executive session is 25 O.S. § 307B1.",""," ","","6. INFORMATION ITEMS",""," ","","Community Development monthly report","Okmulgee Police Department monthly report","Fire Department monthly report","Legal Department monthly report","Finance Department monthly report","Technology Services monthly report","Financials","City Manager’s Report"," ","","7. COMMENTS AND INQUIRIES FROM COUNCIL",""," ","","8. ADJOURNMENT","","","","A G E N D A ",""," ","","Okmulgee Municipal Authority, regular session, Tuesday, December 17, 2013 at 5:00 p.m. in the Council Chambers of City Hall, 111 East Fourth Street, Okmulgee, Oklahoma.",""," ","","CALL TO ORDER"," ","","Roll Call of Members"," ","","MINUTES - Consider and vote to approve with any necessary corrections."," ","","November 19, 2013, regular session"," ","","3. CLAIMS – Consider and vote to approve and authorize payment of  such. (See attached Claims List on City Council Meeting.)",""," ","","4. ORDER OF BUSINESS",""," ","","A) Consider and take action with respect to a resolution authorizing the Okmulgee Municipal Authority (the 「Authority」) to issue its utility system and sales tax revenue note, taxable series 2013 (the 「note」) in the aggregate principal amount of not to exceed $4,000,000.00; waiving competitive bidding and authorizing the note to be sold on a negotiated basis; ratifying and confirming the sales tax agreement by and between the city and the authority pertaining to a year-to-year pledge of certain sales tax revenue; approving and authorizing execution of a series 2013 supplemental note indenture authorizing the issuance and securing the payment of the note; providing that the organizational document creating the authority is subject to the provisions of the indenture; ratifying and confirming the lease agreement, pertaining to the city’s utility systems; authorizing and directing the execution of the note and other documents relating to the transaction; and containing other provisions relating thereto.",""," ","","B) Consider and vote to approve selecting which Option, 1) 1 acre cell construction with leachate storage pond, 2) 3 acre cell construction with leachate storage pond, 3) 4.83 acre cell construction with leachate storage pond and completing the sumps for the existing waste and building a transfer station as submitted by Shepherd Engineering for the Okmulgee Landfill.",""," ","",""," ","","5. INFORMATION ITEMS ",""," ","","Public Works monthly report","Wastewater Treatment Plant monthly report","Water Treatment Plant monthly report","Okmulgee Regional Airport monthly report"," ","","6. ADJOURNMENT","","","","A G E N D A",""," ","","The Okmulgee Economic Development Authority will meet in regular session on Tuesday, December 17, 2013 at 5:00 p.m. in the Council Chambers of City Hall, 111 East Fourth Street, Okmulgee, Oklahoma.",""," ",""," ","","1. CALL TO ORDER",""," ","","A. Roll Call of Members",""," ","","2. MINUTES – Consider and vote to approve with any necessary corrections.",""," ","","A. November 19, 2013, regular session",""," ","","3. CLAIMS – Consider and vote to approve and authorize payment of such. (See attached Claims List on City Council Meeting.)",""," ","","4. ADJOURNMENT","","","","","","","","",""] 

我是正確的假設,該「手冊」的錯誤我得到的僅僅是WebMatrix的接口的結果?

事情你可能想知道:

的WebMatrix的錯誤試圖通過WebMatrix中手動修改數據庫的時候,我得到:

Your change could not be committed to the database. 
After you click OK you can fix the invalid entry or press the Esc key to cancel your changes. 

@WhereParam1 : String truncation: max=4000, len=6760, value='["A G E N D A ",""," ","","Okmulgee City Council, regular session, Tuesday, December 17, 2013 at 5:00 p.m. in the Council Chambers of City Hall, 111 East Fourth Street, Okmulgee, Oklahoma.",""," ","","CALL TO ORDER"," ","","Roll Call of Members"," ","","Pledge of Allegiance to the Flag of the United States"," ","","Invocation"," ","","MINUTES - Consider and vote to approve with any necessary corrections"," ","","November 19, 2013, special session","November 19, 2013, regular session"," ","","CLAIMS - Consider and vote to approve and authorize payment of such."," ","","COMMUNICATIONS – Not included on the agenda"," ","","ORDER OF BUSINESS"," ","","A) Consider and take action with respect to a resolution of the city council of the city of Okmulgee, Oklahoma (the 「City」) approving the incurrence of indebtedness by the Okmulgee municipal authority (the 「Authority」) issuing its utility system and sales tax revenue note, series 2013 (the 「note」); providing that the organizational document creating the authority is subject to the provisions of the indenture authorizing the issuance of the note; waiving competitive bidding with respect to the sale of the note and approving the proceedings of the authority pertaining to the sale of said note; ratifying and confirming the sales tax agreement by and between the city and the authority pertaining to the year-to-year pledge of certain sales tax revenues; ratifying and confirming the lease agreement, pertaining to the city’s utility systems; and containing other provisions relating thereto.",""," ","","B) Presentation by Joe Prentice concerning damages to the Okmulgee Police Department.",""," ","","C) Consider and vote to approve retirement benefits for Jeremy Porter.",""," ","","D) Consider and vote to adopt an ordinance on standards for oversized loads being trucked through the city in which the standards are all contained in existing state law and/or metro Tulsa ordinances; and declaring an emergency.",""," ","","E) Consider and vote to approve, approve conditionally or disapprove the preliminary plat of Okmulgee Business Complex, a portion of the SE quarter of Section 31, T-14-N, R-13-E, Indian base and meridian Okmulgee County, State of Oklahoma.",""," ","","F) Consider and vote to approve acceptance of a bid for the purchase of two (2) Ford AWD police utility vehicles from the lowest, most responsible bidder and authorize the Mayor and City Clerk to execute the necessary documents.",""," ","","G) Consider and vote to approve a lease Extension for a period of an additional six months on the Eldon Day Lease.",""," ","","H) Consider and possibly both grant and accept the donation of a public utility easement for the City of Okmulgee.",""," ",""," I) Consider and vote to approve the appointment of Jack J. Willis or Brian Priegel to the Planning and Zoning Commission.",""," ","","     J) Consider and vote to approve appointment of a representative of the governing body and an alternate to the Indian Nations Council of Governments (INCOG) Board of Directors.",""," ","","    K) Consider and vote to hold an executive session to discuss the potential hiring of a new Okmulgee City Manager. At the conclusion of the executive session, the Council will reconvene to take such action as may be useful or appropriate to hire or appoint a new City Manager, change the proposed benefit package, or eliminate individual candidates from the applicant pool as they deem useful. Authority for an executive session is 25 O.S. § 307B1.",""," ","","6. INFORMATION ITEMS",""," ","","Community Development monthly report","Okmulgee Police Department monthly report","Fire Department monthly report","Legal Department monthly report","Finance Department monthly report","Technology Services monthly report","Financials","City Manager’s Report"," ","","7. COMMENTS AND INQUIRIES FROM COUNCIL",""," ","","8. ADJOURNMENT","","","","A G E N D A ",""," ","","Okmulgee Municipal Authority, regular session, Tuesday, December 17, 2013 at 5:00 p.m. in the Council Chambers of City Hall, 111 East Fourth Street, Okmulgee, Oklahoma.",""," ","","CALL TO ORDER"," ","","Roll Call of Members"," ","","MINUTES - Consider and vote to approve with any necessary corrections."," ","","November 19, 2013, regular session"," ","","3. CLAIMS – Consider and vote to approve and authorize payment of  such. (See attached Claims List on City Council Meeting.)",""," ","","4. ORDER OF BUSINESS",""," ","","A) Consider and take action with respect to a resolution authorizing the Okmulgee Municipal Authority (the 「Authority」) to issue its utility system and sales tax revenue note, taxable series 2013 (the 「note」) in the aggregate principal amount of not to exceed $4,000,000.00; waiving competitive bidding and authorizing the note to be sold on a negotiated basis; ratifying and confirming the sales tax agreement by and between the city and the authority pertaining to a year-to-year pledge of certain sales tax revenue; approving and authorizing execution of a series 2013 supplemental note indenture authorizing the issuance and securing the payment of the note; providing that the organizational document creating the authority is subject to the provisions of the indenture; ratifying and confirming the lease agreement, pertaining to the city’s utility systems; authorizing and directing the execution of the note and other documents relating to the transaction; and containing other provisions relating thereto.",""," ","","B) Consider and vote to approve selecting which Option, 1) 1 acre cell construction with leachate storage pond, 2) 3 acre cell construction with leachate storage pond, 3) 4.83 acre cell construction with leachate storage pond and completing the sumps for the existing waste and building a transfer station as submitted by Shepherd Engineering for the Okmulgee Landfill.",""," ","",""," ","","5. INFORMATION ITEMS ",""," ","","Public Works monthly report","Wastewater Treatment Plant monthly report","Water Treatment Plant monthly report","Okmulgee Regional Airport monthly report"," ","","6. ADJOURNMENT","","","","A G E N D A",""," ","","The Okmulgee Economic Development Authority will meet in regular session on Tuesday, December 17, 2013 at 5:00 p.m. in the Council Chambers of City Hall, 111 East Fourth Street, Okmulgee, Oklahoma.",""," ",""," ","","1. CALL TO ORDER",""," ","","A. Roll Call of Members",""," ","","2. MINUTES – Consider and vote to approve with any necessary corrections.",""," ","","A. November 19, 2013, regular session",""," ","","3. CLAIMS – Consider and vote to approve and authorize payment of such. (See attached Claims List on City Council Meeting.)",""," ","","4. ADJOURNMENT","","","","","","","","",""]'. 

System.InvalidOperationException: @WhereParam1 : String truncation: max=4000, len=6760, value='["A G E N D A ",""," ","","Okmulgee City Council, regular session, Tuesday, December 17, 2013 at 5:00 p.m. in the Council Chambers of City Hall, 111 East Fourth Street, Okmulgee, Oklahoma.",""," ","","CALL TO ORDER"," ","","Roll Call of Members"," ","","Pledge of Allegiance to the Flag of the United States"," ","","Invocation"," ","","MINUTES - Consider and vote to approve with any necessary corrections"," ","","November 19, 2013, special session","November 19, 2013, regular session"," ","","CLAIMS - Consider and vote to approve and authorize payment of such."," ","","COMMUNICATIONS – Not included on the agenda"," ","","ORDER OF BUSINESS"," ","","A) Consider and take action with respect to a resolution of the city council of the city of Okmulgee, Oklahoma (the 「City」) approving the incurrence of indebtedness by the Okmulgee municipal authority (the 「Authority」) issuing its utility system and sales tax revenue note, series 2013 (the 「note」); providing that the organizational document creating the authority is subject to the provisions of the indenture authorizing the issuance of the note; waiving competitive bidding with respect to the sale of the note and approving the proceedings of the authority pertaining to the sale of said note; ratifying and confirming the sales tax agreement by and between the city and the authority pertaining to the year-to-year pledge of certain sales tax revenues; ratifying and confirming the lease agreement, pertaining to the city’s utility systems; and containing other provisions relating thereto.",""," ","","B) Presentation by Joe Prentice concerning damages to the Okmulgee Police Department.",""," ","","C) Consider and vote to approve retirement benefits for Jeremy Porter.",""," ","","D) Consider and vote to adopt an ordinance on standards for oversized loads being trucked through the city in which the standards are all contained in existing state law and/or metro Tulsa ordinances; and declaring an emergency.",""," ","","E) Consider and vote to approve, approve conditionally or disapprove the preliminary plat of Okmulgee Business Complex, a portion of the SE quarter of Section 31, T-14-N, R-13-E, Indian base and meridian Okmulgee County, State of Oklahoma.",""," ","","F) Consider and vote to approve acceptance of a bid for the purchase of two (2) Ford AWD police utility vehicles from the lowest, most responsible bidder and authorize the Mayor and City Clerk to execute the necessary documents.",""," ","","G) Consider and vote to approve a lease Extension for a period of an additional six months on the Eldon Day Lease.",""," ","","H) Consider and possibly both grant and accept the donation of a public utility easement for the City of Okmulgee.",""," ",""," I) Consider and vote to approve the appointment of Jack J. Willis or Brian Priegel to the Planning and Zoning Commission.",""," ","","     J) Consider and vote to approve appointment of a representative of the governing body and an alternate to the Indian Nations Council of Governments (INCOG) Board of Directors.",""," ","","    K) Consider and vote to hold an executive session to discuss the potential hiring of a new Okmulgee City Manager. At the conclusion of the executive session, the Council will reconvene to take such action as may be useful or appropriate to hire or appoint a new City Manager, change the proposed benefit package, or eliminate individual candidates from the applicant pool as they deem useful. Authority for an executive session is 25 O.S. § 307B1.",""," ","","6. INFORMATION ITEMS",""," ","","Community Development monthly report","Okmulgee Police Department monthly report","Fire Department monthly report","Legal Department monthly report","Finance Department monthly report","Technology Services monthly report","Financials","City Manager’s Report"," ","","7. COMMENTS AND INQUIRIES FROM COUNCIL",""," ","","8. ADJOURNMENT","","","","A G E N D A ",""," ","","Okmulgee Municipal Authority, regular session, Tuesday, December 17, 2013 at 5:00 p.m. in the Council Chambers of City Hall, 111 East Fourth Street, Okmulgee, Oklahoma.",""," ","","CALL TO ORDER"," ","","Roll Call of Members"," ","","MINUTES - Consider and vote to approve with any necessary corrections."," ","","November 19, 2013, regular session"," ","","3. CLAIMS – Consider and vote to approve and authorize payment of  such. (See attached Claims List on City Council Meeting.)",""," ","","4. ORDER OF BUSINESS",""," ","","A) Consider and take action with respect to a resolution authorizing the Okmulgee Municipal Authority (the 「Authority」) to issue its utility system and sales tax revenue note, taxable series 2013 (the 「note」) in the aggregate principal amount of not to exceed $4,000,000.00; waiving competitive bidding and authorizing the note to be sold on a negotiated basis; ratifying and confirming the sales tax agreement by and between the city and the authority pertaining to a year-to-year pledge of certain sales tax revenue; approving and authorizing execution of a series 2013 supplemental note indenture authorizing the issuance and securing the payment of the note; providing that the organizational document creating the authority is subject to the provisions of the indenture; ratifying and confirming the lease agreement, pertaining to the city’s utility systems; authorizing and directing the execution of the note and other documents relating to the transaction; and containing other provisions relating thereto.",""," ","","B) Consider and vote to approve selecting which Option, 1) 1 acre cell construction with leachate storage pond, 2) 3 acre cell construction with leachate storage pond, 3) 4.83 acre cell construction with leachate storage pond and completing the sumps for the existing waste and building a transfer station as submitted by Shepherd Engineering for the Okmulgee Landfill.",""," ","",""," ","","5. INFORMATION ITEMS ",""," ","","Public Works monthly report","Wastewater Treatment Plant monthly report","Water Treatment Plant monthly report","Okmulgee Regional Airport monthly report"," ","","6. ADJOURNMENT","","","","A G E N D A",""," ","","The Okmulgee Economic Development Authority will meet in regular session on Tuesday, December 17, 2013 at 5:00 p.m. in the Council Chambers of City Hall, 111 East Fourth Street, Okmulgee, Oklahoma.",""," ",""," ","","1. CALL TO ORDER",""," ","","A. Roll Call of Members",""," ","","2. MINUTES – Consider and vote to approve with any necessary corrections.",""," ","","A. November 19, 2013, regular session",""," ","","3. CLAIMS – Consider and vote to approve and authorize payment of such. (See attached Claims List on City Council Meeting.)",""," ","","4. ADJOURNMENT","","","","","","","","",""]'. 
    at System.Data.SqlServerCe.SqlCeCommand.FillParameterDataBindings(Boolean verifyValue) 
    at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) 
    at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() 
    at Microsoft.WebMatrix.DatabaseManager.SqlCeDatabase.SqlCeDatabaseProvider.EditRowInternal(DbConnection connection, DbTransaction transaction, String tableName, String schema, IList`1 columnDataInfoList) 
    at Microsoft.WebMatrix.DatabaseManager.SqlCeDatabase.SqlCeDatabaseProvider.EditRow(String connectionString, String tableName, String schema, IList`1 columnDataInfoList) 
    at Microsoft.WebMatrix.DatabaseManager.IisDbManagerModuleService.EditRow(DatabaseConnection databaseConnection, String tableName, String schema, ArrayList columnDataInfoArrayList, String configPathState) 
    at Microsoft.WebMatrix.DatabaseManager.Client.ClientConnection.EditRow(String name, String schema, ArrayList columnDataInfo) 
    at Microsoft.WebMatrix.DatabaseManager.Client.ClientTable.EditRow(ArrayList columnData) 
    at Microsoft.WebMatrix.DatabaseManager.Client.DataView.EditRow(RowData rowData, Object[] originalValues) 
  • 字段的數據類型存儲這個字符串是ntext,因爲SQL Server CE缺少對nvarchar(max)的支持(最高可獲得的是nvarchar(4000)
  • There沒有用於從數據庫中讀取此值的接口,因爲它僅用於記錄目的。
+0

這是WebMatrix數據管理工具中的一個錯誤。嘗試使用編程方式進行更新。 –

+0

@MikeBrind好吧,那就是我的想法。那我不覺得那麼糟糕。只是想確保我沒有爲數據庫故障或任何事情設置自己。如果您不介意快速回答,我會很樂意接受和鼓勵。再次感謝! – VoidKing

回答

1

這是WebMatrix數據管理工具中的一個錯誤。嘗試使用編程方式進行更新。

相關問題