e.Exception == null

Posts   
 
    
deathwish
User
Posts: 56
Joined: 07-Nov-2006
# Posted on: 12-Jan-2009 07:29:26   

Hi,

This is probably such a small thing, or I have missed something but I cant figure it out. Must be the Monday blues and my brain is still waking up. simple_smile

I have done a few self servicing projects and now started using the Adapter on a new project.

Currently using: - LLBLGen 2.6.8.1211 (Adapter) - VS 2008 - SQL 2008

Now when I insert an item via a DetailsView, the record is inserted into the DB but there is an exception that is generated somewhere after that and I cannot find it. I have attached the error.

When I try to create a watch for the exception I get "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."

This is the code for a custom DetailsView OnItemInserted event.


protected override void OnItemInserted(DetailsViewInsertedEventArgs e)
{
    if (e.Exception == null)
        ClearSelection();

    OnItemInsertedEvent(e);
}

All that I can see is _ComPlusExceptionCode -532459699. I have tried it on two different tables and they both insert but give the exception.

The table contains 3 fields: - SiteId uniqueidentifier (newsequentialid()) - SiteTypeId uniqueidentifier (FK) - Name varchar (100) with unique constraint

Strangely enough the update works perfectly on these table and the e.Exception == null. ?!?

Twilight music in the background...

Thanks.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 12-Jan-2009 08:48:51   

Are you firing a Response.Redirect or Server.Transfer on a try block? Could you post the RowCommand event for the DetailsView or wherever you are firing the insert of the entity?

David Elizondo | LLBLGen Support Team
deathwish
User
Posts: 56
Joined: 07-Nov-2006
# Posted on: 12-Jan-2009 09:52:08   

Ah i see,

The LLBLGenDataSource2 control was redirecting after an insert...


protected void siteCollectionDataSource_EntityInserted(object sender, DataSourceActionEventArgs e)
{
    SiteEntity entity = e.InvolvedEntity as SiteEntity;
            
    Response.Redirect("/admin/site/details.aspx?siteId=" + entity.SiteId);
}

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 12-Jan-2009 10:19:40   

Why are you redirecting? Is that to the same page, just to refresh the controls in there?

deathwish
User
Posts: 56
Joined: 07-Nov-2006
# Posted on: 12-Jan-2009 10:30:10   

Hey,

There is a tab control that is only displayed when there is a querystring parameter and it contains tabs to a bunch of pages for related items etc.

And of course the data source control uses it for updating simple_smile . Two way binding ftw.


<llblgenpro:llblgenprodatasource2 id="siteCollectionDataSource" runat="server">
    <selectparameters>
        <asp:querystringparameter name="SiteId" querystringfield="siteId" />
    </selectparameters>
</llblgenpro:llblgenprodatasource2>

I've just removed the code from the EntityInserted method and modified the OnItemInserted to redirect if there is no exception. Works fine.

Thanks for the help guys.

P.S. You guys should have another forum called "Rookie Monday/Hangover Questions". Mine would fit right in.