Note that there are some explanatory texts on larger screens.

plurals
  1. POWp insert into db exception
    text
    copied!<p>My code worked for more than a month, my app parse rss feed (<a href="http://www.whitehouse.gov/feed/blog/white-house" rel="nofollow">http://www.whitehouse.gov/feed/blog/white-house</a>) and insert news into db:</p> <p>today I got an exception when app try to add this news "The First Lady's Box at the 2013 State of the Union" to db. here is my code:</p> <pre><code>News item = Query.instance().AddNews(channel.Guid, channel.Description, channel.Link, channel.PublishDate, channel.Title); public News AddNews(string guid, string description, string link, DateTime publishDate, string title) { // create a new and add it to the context News item = new News { Guid = guid, Description = description, Link = link, PublishDate = publishDate, Title = title }; // add the new to the context db.NewsItems.InsertOnSubmit(item); // save changes to the database db.SubmitChanges(); return item; } </code></pre> <p>Imade a debug and the the problem is into description of the news (it seems the lenght), here is the exception:</p> <blockquote> <p>"An exception of type 'System.InvalidOperationException' occurred in Microsoft.Phone.Data.Internal.ni.dll and wasn't handled before a managed/native boundary A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.Linq.ni.dll"</p> </blockquote> <p>and this is the column description into db</p> <pre><code>private string _description; [Column] public string Description { get { return _description; } set { if (_description != value) { NotifyPropertyChanging("Description"); _description = value; // Remove HTML tags. _description = Regex.Replace(_description, "&lt;[^&gt;]+&gt;", string.Empty); // Remove newline characters _description = _description.Replace("\r", "").Replace("\n", ""); // Remove encoded HTML characters _description = HttpUtility.HtmlDecode(_description); //replace spaces _description = _description.Replace(" ", ""); //if (!string.IsNullOrEmpty(_description) &amp;&amp; _description.Length &gt; 3900) // _description = _description.Substring(0, 3900); NotifyPropertyChanged("Description"); } } } </code></pre> <p>when i uncomment this it works:</p> <pre><code>//if (!string.IsNullOrEmpty(_description) &amp;&amp; _description.Length &gt; 3900) // _description = _description.Substring(0, 3900); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload