.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Event Handler returning unexpected Error Code

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :Sql Server


I am trying to set up an Event Handler to log errors to a table.

So in my Control Flow pane I set an Execute SQL Task with a deliberate error as follows; -

Name; - Execute SQL Task with Deliberate Error

SQLStatement; - SELECT * FROM InvalidTable


Within the Event Handler tab I created a further Execute SQL Statement based on the Event handler OnError

Name : Log

Parameter Mapping
Variable Name System:ErrorCode
Direction Input
Parameter Name 0
Parameter Size 100

SQLStatement INSERT INTO dbo.CustomSSISLog  (ErrorCode) VALUES (?)

Error Output; -

SSIS package "ErrorLogTemplate.dtsx" starting.

Error: 0xC002F210 at Execute SQL Task with Deliberate Error, Execute SQL Task: Executing the query "SELECT * FROM InvalidTable" failed with the following error: "Invalid object name 'InvalidTable'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Task failed: Execute SQL Task with Deliberate Error

Warning: 0x80019002 at ErrorLogTemplate: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of er

View Complete Post

More Related Resource Links

Creating Event Handler in Code behind


Hi, so I have a control that is created in the code behind and generates fine but I can't figure out how to create an event handler for it.  I've found plenty of examples for it in C sharp, but none of them seem to apply to VB.  What I want to do is essentially this:

myDropDownList.SelectedIndexChanged = "Event to do here"

but it doesn't seem to work for me.

Any suggestions are appreciated.

WebFaultException throwing a "not handled by user code" error and returning an HTTP 500 to the clien

I am trying to return a BadRequest and simple message when implentation throws an error in a WCF REST service, but the WebFaultExcption itself is throwing an exception and returning an HTTP 500 instead. Any ideas on why this might be happening? Here is a short code snippet: [WebDispatchFormatter] [WebHelp(Comment="Initiate an immediate or callback appoinment request")] [WebInvoke(UriTemplate = "InitiateContact", Method = Verbs.Post)] public string InitiateContact(AppointmentRqst rqst) {      string ret = string.Empty;      rqst.DeviceId = Helper.GetHttpAuthHdrDeviceId();      try      {          ret = impl.InitiateContact(rqst);      }      catch (Exception ex)      {          throw new WebFaultException<string>(ex.Message, HttpStatusCode.BadRequest);      }      return ret; }

Event Handler not picking up error

I have a connection manager which uses a Variable as part of a ConnectionString. I have tried putting an Event handler on the package to capture any errors with the connection string. Unfortunately the event handler does not pick up any errors. I would like to add some screenshot but i am not sure how to do it on this forum.  Mr Shaw

Code in an event handler not working when used with system reflection.

Hi, I am presently writing an application that uses an MDI form with a ToolStrip on it. I have the need to build the menu items dynamically using an XML file. The format of the XML file is as follows: <ContextMenu EventHandlerHost="vFrmPDUsetup"> <!-- These styles will be applied to the menu items. Individual menu item styles can be override by defining as an attibute to the specific menu item, see below --> <Style> <MenuStripBackColour>Transparent</MenuStripBackColour> <BackColour></BackColour> <ForeColour>Chartreuse</ForeColour> <BackImage></BackImage> <!-- Must exist in Images folder --> <FontName>Tahoma</FontName> <FontSize>10</FontSize> <FontStyle>Bold</FontStyle> </Style> <!-- Attributes: Key = Resource Key name in resource file Image = image to display before text, image must exist in Images folder BackImage = background image, image must exist in Images folder BackColour = background colour as colour name ForeColour = foreground colour as colour name FontSize = size of font as value Seperator = add a menu seperator OnClick = click event pointing to the event handler method which must be defined as the MenuItem_ + <attibute value> &

MVVM how to move event handler from code behind to ViewModel


First of all I'm fairly new to WPF and MVVM. For learning purposes I created a very simple MVVM test app similar to the one demonstrated here: http://windowsclient.net/learn/video.aspx?v=314683

I am trying to find out how to work with events in the MVVM pattern. To work with events in the xaml code behind is simple. But how to move the code to the ViewModel?

In the xaml I have:

    <StackPanel Background="{Binding BackgroundBrush}">
        <ItemsControl ItemsSource="{Binding AllEmployees}">
                    <StackPanel Orientation="Horizontal">
                        <TextBox Width="100" Text="{Binding FirstName}" />
                        <TextBox Width="100&q

ItemUpdating event handler causes SPRequest object was not disposed error if properties.ListItem is


I have a very simple ItemUpdating event handler that is causing an SPRequest object was not disposed error when it is fired. The event handler is linked to the document library. I have cleaned out all of my code and narrowed it down to this:

    public override void ItemUpdating(SPItemEventProperties properties)
      SPListItem item = properties.ListItem;

When I change the name of a file or folder in my document list the following line is logged in the SP log:

An SPRequest object was not disposed before the end of this thread.  To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.  This object will now be disposed.  Allocation Id: {D7AA6805-4CA1-458B-9252-E83D32DBD0D3}  To determine where this object was allocated, set Microsoft.SharePoint.Administration.SPWebService.ContentService.CollectSPRequestAllocationCallStacks = true.


As an extra note I have actually set the CollectSPRequestAllocationCallStacks to true, this is all the information that it gives me. If I comment out the pr

The operation failed because an unexpected error occurred. (Result Code: 0x81071003)


Hi all,  I have a SINGLE web service that I call through two different programs.  I input the same values into the service and call a sevice method.  One call fails every time, one call works every time.  I have installed Fiddler2 and copied the requests and responses from each.  They are identical except for the [VsDebuggerCausalityData] header value and the [Authorization:] value (data below)  what is this error? What can I do to address it? Why does it work for one app, but not the other when the requests are the same.  I guess since the Authorization is different it could be a security problem. But I'm not so sure because I'm not getting a security type error.  The first trace is the working example (look at the response) the second is the failing call.  I have changed the Authorization values.

POST http://kerryportal/global/DMS/CRM/_vti_bin/Lists.asmx HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.4952)
VsDebuggerCausalityData: uIDPo+bNI0fMARFBsgZwKLhVCEUBAAAA2xBAL4gjpUWSP4dBtR8U/4q2nB9UKJVFvuCo3qZaaXUACQAA
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://schemas.microsoft.com/

Control Event Procedures in Code-behind Causing Error


I'm using Web Developer 2010.  I have a webpage that runs fine with no errors unless I have it automatically create an event procedure from one of the controls.  Even though it doesn't show any error in the Errors list, the following error shows up in a message box, "There were build errors.  Would you like to continue and run the last successful build?"

I have a number of objects on the page, but in the Code-behind, I only need the Selected event for the ObjectDataSource and the Click event for the button.  In both cases I create the event procedure by selecting it from the Events list of the Properties window.

But if either one or both is created--even just an empty procedure--and if the web applcation started, it will give the error above.  Only if the Code-behind is without any event procedures added wiill the web applicaiton start without giving an error.

Any idea if there is a way to fix this?  I need to have a couple of procedures in the Code_Behind.


I get the following errors when I compile it, though if I hit ok, the site runs:

C:\Websites\MyDomainName\TonyMain.aspx.vb(6,0): error BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.


List Item Update Exception from HRESULT: 0x80040E2F Unexpected query execution failure, error code 3


A thread somewhat simliar to this has been posted before as well, but i just wanted to detail out the issue and circumstances

We have a list with 53 columns and 2600 items(and growing. I know its rubbish, but thats the way it is at the moment). The list was created using SharePoint GUI  on a test server, saved as a template with data, and was then imported to the production environment. I can post the list columns and type if it helps.

Every one in a while, on updating an item, SharePoint throws up the very not so helpful error page with "Exception from HRESULT: 0x80040E2F".

We looked into the logs and found that for each suc error, there was a Database level error logged as well.

The error starts with Unexpected query execution failure, error code 3621. Additional error information from SQL Server is included below. "The statement has been terminated." Query text (if available): "BEGIN TRAN;DECLARE... and runs for many lines so i wont post the entire blurb here.

Each time, the item update is successful, despite this error. The list also has an Item Updated event handler attached to it. Every time the update error occurs, the event handler does not seem to be firing.

Anybody can shed light on what is happening. We have tried exporting the list template to another site and everything seemed to work

Returning a value from UploadStringCompleted Event Handler


Hi guys,

I'm trying to return the result from UploadedStringCompleted event handler but have no idea how to that, as the return type for an event handler can only be void. I also tried setting a class wide variable in the UploadStringCompleted event handler and then returning the variable, but I'm using UploadStringAsync so that doesn't work.  I'm developing a Windows Phone 7 appliaction so the UploadString method for WebClient is not available. I have tried a bunch of other thing and have been unsuccessful. Please help. Here is my code:

private WebClient wc = new WebClient();


 private string responseXml = "";

 public string SendRequest(string request)


  Uri apiUrl = new Uri(http://www.google.com);

  string token = "225";

  wc.Credentials = new NetworkCredential(token, "X&qu

Event Handler (send mail task) firing multiple times for each dataflow error - How can I stop the da


I've set up an OnError event handler for my package which sends an email containing the name of the file that fails import through my dataflow task. The problem is the dataflow experiences three errors (one for each task it is attempting to complete) which in turn causes three duplicate emails to be sent.

I'd prefer to stop the dataflow task completely rather than allow it to try to complete the remaining tasks after the first error. Is this possible? Alternately, how can I set up my event handler to only send one email regardless of the number of dataflow errors that occur?

Thanks in advance!

Sharepoint Infopath error (Event Code 3005)


To all expert,

I need help urgently! I'm having below error. I have tried to fix by reset IIS but still can't work.

Please help to advice what should I do next?

I'm using sharepoint 2007 sp2.


Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 4/12/2011 4:39:00 PM
Event time (UTC): 4/12/2011 8:39:00 AM
Event ID: 4c4bbb1d99d24056bcd7dcaf2d135e65
Event sequence: 16
Event occurrence: 1
Event detail code: 0
Application information:
    Application domain: /LM/W3SVC/357097357/Root/GoodsPass-3-129470710950054281
    Trust level: Full
    Application Virtual Path: /GoodsPass
    Application Path: C:\Inetpub\WebApp\GoodsPass\
    Machine name: PEN01NT
Process information:
    Process ID: 6740
    Process name: w3wp.exe
    Account name: PEN01NT\admin
Exception information:
    Exception type: NullReferenceException
    Exception message: Object reference not set to an instance of an object.
Request information:
    Request URL: http://pen01nt:10599/GoodsPass/default.aspx

Event ID 1011 - DefaultAppPool World Wid Web Pub. Serv. fatal communication error

We have a Windows 2003 server running IIS6 1.1 Framework. We have also installed a DNS and Active Directory in the same machine.

We're randomly getting the error you can see below. Sometimes it causes the recycling of process w3wp.exe (which on my understanding represents the application pool worker processd) and other times results on this process hanging and not responding to any request. To do iisrest temporarly solves the problem.

We were pointed to a possible permissions problem between the user we were runnig the DefaultAppPool with and registry entries used by the iis. We noticed the default predifined user we used, Network Service, wasn't found in the Active Directory, so we changed it by the default configurable user, IWAM_MACHINE_NAME, which is under the IIS_WPG Active Directory Grupo, which, in theory has the correct permissions to run the application pool.

Well, none of this worked and we are still getting this error.

This is driving us crazy and think the problem might have to do with having the Domain Controller/Active Directory and the IIS6 running on the same machine. We'll try now uninstalling this DC pointing to another one to see what happens.

Any help would be appreciated.

Thanks in advance,


Event Type: Warning

Ho to fire the Application Error in asax from the code?


 Hi All,

I have this code in Global.asax but it not firing once an error occured:


void Application_Error(object sender, EventArgs e)



        // Get the error details

        HttpException lastErrorWrapper = Server.GetLastError() as HttpException;

        Exception lastError = lastErrorWrapper;

        if (lastErrorWrapper.InnerException != null)

        lastError = lastErrorWrapper.InnerException;



        string lastErrorTypeName = lastError.GetType().ToString();

        string lastErrorMessage = lastError.Message;

        string lastErrorStackTrace = lastError.StackTrace;



Please help me so I can call this method from any page?

Thaxxxxxxxxxxxxx a lot,



want to launch modal Popup from created User Event handler




I have a create user wizard on my page and in the event handler (Created User) I get extra information from the user

via textboxes within the aspx etc.


I then do a response.redirect to another page.

What I want to happen is this


When the CreatedUser Event is fired, I  want a Modal Popup to show up with a message Processing your registration.

once the registration code is processed it will close and the users get redirected.


On my ASPX I have the Modal PopUp and a Panel.

In the code behind in the handler I put ModalPop.show()


but this does not work.


thanks for any suggestions



The underlying connection was closed: An unexpected error occurred on a send.


I am consuming a third party web service wsdl using my .net aps.net page. And I am getting following error message. Cannt get to resolve it. Its working on my machine but not in my development machine. I have installed the certificate also in certificates on that machine. Can somone please help.?

Error -->  The underlying connection was closed: An unexpected error occurred on a send.





ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend