Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

ListView. Strange Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shapper - 12 Dec 2007 17:28 GMT
Hello,

I have a ListView connected to a LinqDataSource. All records are
showing the right way.

When I click the Delete item on a row I get the following error:
"Cannot remove an entity that has not been attached"

Does anyone has any idea why I am getting this error?

Thanks,
Miguel
David Wier - 12 Dec 2007 23:12 GMT
Take a look at this, and see if it helps:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2432732&SiteID=1

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup

> Hello,
>
[quoted text clipped - 8 lines]
> Thanks,
> Miguel
shapper - 13 Dec 2007 01:18 GMT
> Take a look at this, and see if it helps:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2432732&SiteID=1
>
[quoted text clipped - 13 lines]
> > Thanks,
> > Miguel

Hi,

I follow your hint and solved that error and now I have a new one when
I delete a row:
" Exception Details: System.Data.Linq.ChangeConflictException: Row not
found or changed."

Any idea why do I get this error?

   Private Sub ldsTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles ldsTags.Init
     With ldsTags
       .ContextTypeName = "MyDbDataContext"
       .EnableDelete = True
       .EnableInsert = True
       .EnableUpdate = True
       .ID = "ldsTags"
       .TableName = "Tags"
     End With
   End Sub ' ldsTags_Init

   Private Sub ldsTags_Deleting(ByVal sender As Object, ByVal e As
LinqDataSourceDeleteEventArgs) Handles ldsTags.Deleting

     Dim tag As Tag = CType(e.OriginalObject, Tag)
     Dim database As New MyDbDataContext
     database.Tags.Attach(tag)
     database.Tags.DeleteOnSubmit(tag)
     database.SubmitChanges()

   End Sub ' ldsTags_Deleting

   Private Sub ldsTags_Selecting(ByVal sender As Object, ByVal e As
LinqDataSourceSelectEventArgs) Handles ldsTags.Selecting
     Dim database As New MyDbDataContext
     Dim tags = From t In database.Tags _
                Select t.TagID, _
                       t.Text, _
                       Active = t.FilesTags.Any Or t.ArticlesTags.Any
     e.Result = tags
   End Sub ' ldsTags_Selecting

   ' lvTags_Init
   Private Sub lvTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Init
     With lvTags
       .DataSourceID = "ldsTags"
       .DataKeyNames = New String() {"TagID"}
       .ID = "lvTags"
       .InsertItemPosition = InsertItemPosition.FirstItem
     End With
     With lvTags
       .EditItemTemplate = New
TagsTemplate(TemplateType.EditItemTemplate)
       .EmptyDataTemplate = New
TagsTemplate(TemplateType.EmptyDataTemplate)
       .InsertItemTemplate = New
TagsTemplate(TemplateType.InsertItemTemplate)
       .ItemTemplate = New TagsTemplate(TemplateType.ItemTemplate)
       .LayoutTemplate = New
TagsTemplate(TemplateType.LayoutTemplate)
     End With
   End Sub ' lvTags_Init

   Private Sub lvTags_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Load
     lvTags.DataBind()
   End Sub ' lvTags_Load

Thanks,
Miguel

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.