Skip to main content

Email Alerts are not received...

In one of application, Email alerts are sent using SQL sp_send_dbmail stored procedure. Email alerts were working properly, but suddenly noticed email alerts are not received.

To troubleshoot the issue, first I checked the msdb.dbo.sysmail_event_log table using the below query.

SELECT log_id, event_type, log_date, description, process_id, mailitem_id, account_id, last_mod_date, last_mod_user
log_date DESC

If there is any error, you should see records with the event_type value as error.
In my case there are records with event_type value as error, and the description value for those records is same as below

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2018-02-01T10:41:27). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: Authentication required).  )

As per the error descript…

Passing Parameter value for a rdlc report in ASP.Net and Windows Forms......

In most of the times we need to filter report data. Recently I had a requirement to create a rdlc report and add it to an ASP.Net page. In that I need to filter data using the name.

In ASP.Net and Windows forms, creating data set and reports parts are same. The different is passing the parameter value from the code.

In ASP.Net, steps used are

  • Create a Data Set by right click on the project and select Add → New Item
  • Then select Data → DataSet
  • When the DataSet is added to the solution, right click on the DataSet Designer and select Add→TableAdapter.
  • In that you need to provide the query to retrieve data and in this example I assume it as SELECT Name, Address, ContactNo FROM Users WHERE (Name LIKE @name + '%')
  • @name is the parameter which we need to pass.
  • Then add a new report and select the DataSet as the one which we created earlier.
  • Then add a ReportViewer component and select the Report as the one created earlier.
These steps are common for the Windows Forms as well. But next steps are different in ASP.Net and Windows Forms.

In ASP.Net
  • When the report is added to the report viewer, ObjectDataSource is automatically added. You need to configure it to pass the parameter.
  • Click on the arrow in the ObjectDataSource and select Configure Data Source. In the wizard you will get a step to define parameters as shown in the below figure.

  • Provide the required details as shown in the figure and click on Finish.
  • Then go to aspx.cs file and add the below code in the View button click event. Here View button is used to view the report by passing parameters. To enter parameter value a TextBox is used.

    protected void btnView_Click(object sender, EventArgs e)
            string name = txtName.Text;

            ObjectDataSource1.SelectParameters["name"].DefaultValue = name;

  • Then when you click the View button, the value provided in the text box is passed as the parameter value and report data is filtered for it.
In Windows Forms
  • When the report is added to the report viewer, TableAdapter is automatically added.
  • You can pass the parameter values for the table adapter. You can pass the parameter values in the View button click event as below.

    protected void btnView_Click(object sender, EventArgs e)
            string name = txtName.Text;

            this.DataTable1TableAdapter.Fill(this.SampleDataSet.DataTable1, name);

  • When the View button is clicked, the parameter values are passed and data set is filtered according to those values.


  1. How to display the parameter that was selected/entered from an ASP textbox into a RDLC report textbox

  2. I spent an entire day trying to get this working. Now it seems to simple. Thanks!

  3. in vs2010 i get a error

    Object reference not set to an instance of an object.

  4. Thanks a lot.Really helpful.Precise and Running successfully.:)


Post a Comment