ReportViewer Control Not Working RRS feed

  • Question

  • Hi,

    I have created a very basic ASP.NET page that has only 1 reportviewer control on it called ReportViewer1.

    I have installed the following code after having created an rdlc and linked it to the report at design time:

            string SQLConnectionString = "Provider=SQLNCLI10;Server=<MyServerName>;Database=<MyDatabaseName>;Uid=asadmin; Pwd=<password>;";

            ReportViewer1.Visible = true;

            string SQLCommandText = "SELECT event_end_datetime, extract_ct FROM Event_log";
            OleDbConnection SQLConnection = new OleDbConnection(SQLConnectionString);
            //OleDbCommand SQLCommand = new OleDbCommand(SQLCommandText, SQLConnection);
            OleDbDataAdapter SQLAdapter = new OleDbDataAdapter(SQLCommandText, SQLConnection);
            DataSet thisDataSet = new DataSet();

            ReportDataSource datasource = new


            int count = thisDataSet.Tables[0].Rows.Count;


    The problem is the page always crashes with the following error:

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    Now, I can drop a datagrid on the page and provide the same credentials and servername settings and populate the gridview without any issues at all; so I know that this error is meaningless for the real issue but I have no clue what the real issue is so I can resolve it.

    I welcome and appreciate any input to assist in resolution.

    Friday, October 16, 2009 7:18 PM

All replies

  • The root cause of the problem is : 

       You are not able to invoke a connection on a SQL Server due to the one/more of the following reasons :

        1. Due to Firewall [hardware or windows firewall] , SQL Server ports not opened 

       2. Allow Remote Connections attribute is not enabled

       3. SQL Server is not running 

       4. TCP/IP is not enabled in SQL Server Configuration .

     For more info on this error refer :

     Hence , this issue is unrelated to your reportviewer control

      Anand R

    Monday, October 19, 2009 8:35 PM
  • Thank you Anand but I already checked all of those possibilities and none of them are applicable.

    There is no firewall, hardware or otherwise between the systems.
    I have checked the server and ensured that Remote connections are enabled. (also this is SQL2008)
    The server is running
    And all network protocols have also been enabled.

    The strange thing is that I can use a data grid control on the same ASP.NET page and connect, and retrieve data without any issues; which also confirms that none of the suggested issues are the problem.

    Thanks for the reply though.
    Thursday, October 22, 2009 1:09 AM
  • I have the same issue, would you please tell me how did u fix it?



    Friday, September 6, 2013 8:06 PM