"A data source instance has not been supplied for the data source" exception w/ Report Viewer Control

I'm using the webform Report Viewer control and I want to render a report locally on SQL Server Reporting Services 2005, CTP15.

After creating the report, I pointed its data source at a SQLDataSource to pull information from the AdventureWorks database. When I launch the webform, I get the following exception:

"A data source instance has not been supplied for the data source 'MyReportDataSource'"

Not good. I dig, and find out that this is a known issue with Beta 2 of Whidbey...and is already fixed in later builds. If you want to get it to work now, the short-term work around is to use an ObjectDataSource, like this:

1. In the SmartTag for the Report Viewer control, click Choose Data Source.

2. In the Choose Data Sources dialog, click inside the Data Source Instance column and choose New Data Source.

3. Choose Object in the list of data sources.

4. In the Choose your business object combo-box, you should already see the name of the Table Adapter that your report will use when it pulls data...choose it.

5. Finish off the wizard...you now should be in good shape.



Comments (60)

  1. Mehrdad says:

    Thank you,

    You made my day, I have read many articles on this issue but no one was as clear as you



  2. Charles says:

    How about setting it an runtime?

  3. Mike says:

    This works great. How do you set the connection string though for the object datasource at runtime? It works fine if using the default wizard config as you specified, but I need to change the connection string in code for when I deploy to the live server.

  4. bill says:

    that did nothing for me.

  5. Tom says:

    Tried and failed. Now I can’t seem to get rid of the old data source. I prevents me from running any report, telling me that it hasn’t been assigned a instance, when I tried to delete it since I no longer want it.

  6. This is fixed now…are you guys still running a pre-RTM version?

  7. Ajamil says:

    I am also getting this error message and haven’t fix it. Could anybody let me know how to get rid off this error


  8. hzwang says:

    I fixed this problem in my project and IMO it’s a bug with the rdlc designer in VS 2005(I am using the released version).

    I am using a Business Object called RptObject and a RptSource which has a method called Get(). The Get() method return a List<RptObject>.

    The error is "A data source instance has not been supplied for the data source ‘RptObject1’".

    I resolved this by opening up the rdlc in Notepad and checked the XML. It turns out the Designer massed up and create two instances of the schema with name RptObject and RptObject1. My ObjectDataSource takes care of the RptObject. Therefore, I manually removed the RptObject1 and changed any references of to RptObject in the XML file.

    Hope this is helpful.

  9. jjones730 says:

    I had the same error message when instantiating a LocalReport at runtime using an ObjectDataSource.  Fixed it by setting the ObjectDataSource.Value parameter.


    ObjectDataSource ods = new ObjectDataSource("MyItems", "GetList");

    ods.ID = myODS";

    ods.SelectParameters.Add("userId", "100");

    ReportDataSource rds = new ReportDataSource("myRDS", ods.ID);

    rds.Value = ods; // Adding this did the trick for me.

    LocalReport lr = new LocalReport();



    lr.ReportPath = Server.MapPath("default.rdlc");

    reportOutput = lr.Render("Excel", null, out mimeType, out encoding, out extension, out streamIds, out warnings);


    Hope this helps someone.  🙂

  10. TL says:


    The Name property in the ReportDataSource has to be set to the full dataset name.  The error message itself references this name…

    ‘A data source instance has not been supplied for the data source ‘<name of data source>’.

    Use this ‘<name of data source>’ as the ReportDataSource .Name property.

  11. Mr Snipey says:

    thanks dude, saved me hours of searching.

  12. Ramesh says:

    After choosing the data source as specified, the VS 2005 itself is closing, any clues or anything wrong

  13. Tamesh, I have the same problem here. Whenever I try to choose or create a data sourceinstance, the VS2005 closes. I think we found a ‘exit’ shortcut =P.

    Workaorund: do everything programmatically.

  14. sfuqua says:

    TL’s comment was the key for me. Using RTM, SP1 in fact, and hadn’t realized that the name given to the ReportDataSource object in my code needed to be the same as the name given in my RDLC. Makes sense I suppose but just wasn’t obvious while writing.

    For future reference: created RDLC based on a struct in a sub-directory/namespace (why struct? b/c it is a very simple value type). Populated a generic List<T> of instances and succesfully bound it to the report’s datasource with: rpt.DataSources.Add(new ReportDataSource("MyNamespace.MyStruct", myList));

  15. sfuqua says:

    Sorry, typed that command in wrong. Should be "MyNamespace_MyStruct" with underscore instead of period.

  16. Barkha says:

    When I follow steps 4 & 5 in the original posts – Visual Studio 2005 takes a dive – no event logs, nothing….


  17. Rodrigo says:

    Great, it worked for me adding the name of datasource in the name of the report data source.


  18. Matt says:

    Resetting the report viewer control programatically is what worked for me.


  19. Christian says:

    Thanks, this article helped me out!

  20. Sanket Gajjar says:

    Thanks, i needed to apply many solutions to solve my problem.

  21. SharonaM says:

    this solution works for me….

    thanks to sfuqua

    ReportViewer1.ProcessingMode = ProcessingMode.Local;

               ReportViewer1.LocalReport.ReportPath = "Reports/CorrectiveActionReport.rdlc";  //this is the path of the report

               ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("LegalCompliance_Code_CorrectiveAction", CorrectiveAction.GetCorrectiveAction(companyId)));  //static class returning a list

  22. Arun says:


           Am Writing the Below Coding and am get the error like A data source instance has not been supplied for the data source

    DataSet ds = new DataSet();

           SqlConnection con = new SqlConnection();

           con.ConnectionString = "Data Source=SYM001;Initial Catalog=House;uid=sa;pwd=”";

           SqlDataAdapter Sqlad = new SqlDataAdapter("Select * from Registration", con);


           ObjectDataSource od = new ObjectDataSource();

           ReportDataSource DataSet2_Registration = new ReportDataSource("Emp", ds.Tables[0].DefaultView);

           ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";


           ReportViewer1.LocalReport.DataSources.Add( DataSet2_Registration);


  23. bobTheCoder says:

    I just went in and edited the XML directly to remove all the old artifacts and detritus that is left behind. THis is pretty appaling tool from microsoft.


  24. Hey Bob – not sure what problem you solved (and how it occured). Care to expand on things a bit?

  25. alan says:

    I came here because I had the same problem – in my case it was because I had a report definition I wanted to duplicate, so after creating the new report rdlc, I copied all the fields from the old report def into the new one. I found I had to drag the new data source columns over again (even though they were the same columns, but for a new datasource), no problem with that, but in the XML report definition I found that it retained the old datasource configuration for the copied fields. Of course in my code I didn’t configure the old datasource, so I had to edit the rdlc in Notepad and remove all references to the old definition. After that, it worked.

  26. khl says:

    Thank you for the help, very useful information.  My issue was resolved with the post from Tuesday, October 24, 2006 7:56 PM by TL.

  27. Heber - BR says:


    Thank you very much!!! You saved my life!

  28. Nanu says:

    thanks guys, saved my life too, in my case I had to open the rdlc in notepad and remove reference to the datasetname that does not exist.

  29. =8)-DX says:

    ..when the DataSource Instance is only mapping say one table out of 3.

  30. kuma says:

    how to carry forward data from 1 report to 2 one

  31. Um says:

    how to do paging and subtotal of first page display in top of second page

  32. newbee says:

    Make sure that the object source for the reportviewer and the datasource fro the report have the [SAME NAME] when you get the error Look for the datasource name in the error and then check

    1) Datasource name of the report

    2) ReportViewer’s Object data source name

    Both these should be the same

    Good luck !

  33. Wow!!1 Great… this information save my life too.. Very Thnaks.

  34. mike says:

    code below fixed it for me…


                   ReportViewer1.ProcessingMode = ProcessingMode.Local;

                   ReportViewer1.LocalReport.ReportPath = "admin\docs\Consultants.rdlc";

                   ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("NTdatasets_vConsultants", ObjectDataSource1));


  35. Lucius says:

    Tnx everyone, the Reset does the trick – saved me (was unable to clear dataset names form the reportviewer). Though I believe the problem is with the control, because I didn’t have this problem on all machines. Maybe SP1 for reportviewer fixes this.

  36. Anil says:

    Many thanks for the solution, TL!! I’ve just been saved by your post.

  37. Brian says:

    Wow when I got this error I thought I was a dead duck for sure.  I did get it to work by adding the data object to the dataset for the report.  I was very confused about how this instance of this object was going to work.  Do I open the connection, create the object instance etc…(Can you tell I am a novice).  Was doing my first web report as well so the confusion was multiplied.  This all worked while 41 warning messages are displayed in Visual Studio regarding schemas and go knows what.  I really hate seeing warning messages.  Too much mess to clean up for now.  Perhaps when I learn more I’ll remove useless attributes or modify them to satisfy the assembler.

  38. Nico says:

    Thanks JJones, Your solution helped me out.

  39. CSharpSean says:

    Thanks! I would have never tried this and it would have wasted a day trying to figure out the problem! Thanks again!

  40. Rick Metz says:

    Very helpful info in discerning what the error message meant.

  41. Vishal Oza says:

    hey thanks !

    I was behind this thing since last 5 hours…

    thank you very much

  42. Pam Minich says:

    Thanks to hzwang (9/27/2007) for the hint about using notepad to edit the XML.

  43. fasil says:


    U save my life ! thanks a lot !!!!!!!!!!

  44. Shree says:

    Man.. You are awesome.. i tried it for 3 hours and came across your post.. you really saved my day….

  45. Anil Vnajre says:

    I’m facing same kind of problem

    i’m using SSRS 2008 and VS 2008

  46. Gary B says:

    Thanks jjones730 !!

    That "rds.Value = ods" fixed my mysterious problem.

  47. Gazala says:

    Thanks it worked for me… : )

  48. granadaCoder says:

    Using Arun’s suggestion (above) I got this to work:

               OrganizationDS ds = //Some method to fill the strong dataset with information//;


               ReportDataSource customReportData = new ReportDataSource();

               customReportData.Name = "Employee";//matches name of datasource in report

               customReportData.Value = ds.Employee;//the data itself


               this.reportViewer1.LocalReport.ReportPath = @".EmployeeListReport5.rdlc";

    Note, Arun had a "ObjectDataSource" declaration that seems like it was unneeded.

  49. Aaron says:

    granadaCoder’s code works perfectly to solve this issue:

    Here is my VB translation for those that don’t do C#:

    Dim RDS As New ReportDataSource("FULL_DS_NAME", ObjectDataSource1)


    ReportViewer1.ProcessingMode = ProcessingMode.Local

    ReportViewer1.LocalReport.ReportPath = "report.rdlc"


  50. ahsan says:

    i have solved my problem like this.

    open your .rdl file in notepad. and find the name of your dataset.


       <DataSet Name="test">

    provide same dataset name while filling your dataset.


  51. Ali Zaheer says:

    Thanks  A lots . It Solve My problem .


    open report as notepad remove extra data source that is in it….

  52. ola_lawal says:

    I was able to use the combined knowlege here to fix my major issues with this crazy control.  Here is a full solution that might help others going forward

    I created a report called ‘report5’ lol 5 is becase 1-4 failed lol.  the report has two parameters for displaying the date range the report shows : i.e datefrom and dateto

    aspx code


    <div id="reports" class ="admin_home_content_header">

       <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"  

           Font-Size="8pt" Height="600px" Width="100%">


       <asp:ObjectDataSource ID="ObjectDataSource3" runat="server"





               <asp:ControlParameter ControlID="txtFromDt" Name="fromdate" PropertyName="Text"

                   Type="DateTime" />

               <asp:ControlParameter ControlID="txtToDt" Name="toDate" PropertyName="Text"

                   Type="DateTime" />

               <asp:ControlParameter ControlID="ComboBoxCustomerList" Name="intCustID"

                   PropertyName="SelectedValue" Type="String" />



       <asp:Label ID="lblMessage" runat="server" Text="status"></asp:Label>


    code behind

    (i use a submit button to execute the report)


    ‘object datasource 3 is decalred on the html side, ps you might need to do a .refresh on your report viewer to get it to work.  Mine worked with or withoute it

    Dim RDS As New ReportDataSource("WareHouseRecordsDataSet_usp_rptRequestForDisposal", ObjectDataSource3)

    ReportViewer1.Reset() ‘reset is important, resets the previous report settings

    ReportViewer1.ProcessingMode = ProcessingMode.Local  ‘self evident

    ‘report name and location

    ReportViewer1.LocalReport.ReportPath = "report5.rdlc"  

    ‘add any report parameters , that are declared on the report side

    Dim paramList As New List(Of ReportParameter)

    paramList.Add(New ReportParameter("FromDt", txtFromDt.Text, True))

    paramList.Add(New ReportParameter("ToDt", txtToDt.Text, True))

    ‘add the params to the report



  53. asus3000 says:

    I did what the article said and it's working on the localserver, but not after publishing to the production server.. When I publish I get the 404 error! It appears as though it has opened the report viewer because there is the beige page selector on top, but the report itself won't open and I don't know if it's the report or the datasource or what is causing the 404…

    HTTP Error 404.0 – Not Found

    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    Detailed Error Information

    Module IIS Web Core

    Notification MapRequestHandler

    Handler StaticFile

    Error Code 0x80070002

  54. abc says:

    i am just importing the rdlc file from another project to my current project bt it is not showing the output. Error showing that is "A Data source has not been supplid to your current report". plz help me.. thanks in advance

  55. mya says:

    Thank you so much.. My report is working well now 🙂

    Thank for allah to let me open this page 🙂

  56. Richa Sharma says:

    This article is really beneficial for me.

  57. Tuomo says:

    Thank you so much, I got my ReportViewer finally working. I spent hours trying to find out why it wasn't working. I begin to hate Visual Studio so much.

  58. skeltech says:

    …and this tip is still valid today! Thank you.

  59. Greg Pyatt says:

    I found another way to solve this problem without having access to the SmartTag of the ReportViewer (this happened because I was using version 10 of the ReportViewer instead of a later version while also using Visual Studio.Net 2012 to do the editing).

    The name of the Data Set in the error message is the key.  Take that name, go into source code view, find the section with the ReportViewer, then inside, find the DataSources tag, and then inside that, find the ReportDataSource tag.  

    Inside the Name property of the ReportDataSource tag, set it to the name of the Data Source mentioned in the error message.  Hopefully this will work for you as it did for me.

    If not, I do feel your pain.

Skip to main content