Solved

Display dataset on aspx page errors in The DataSet in data source 'ObjectDataSource1' does not contain any tables.

Posted on 2010-09-08
4
1,002 Views
Last Modified: 2012-05-10
Code behind
   oConn.Open()
            'Fill dataset
            oData.Fill(resultSet, "Patient")
            'get data table
            Dim dt As DataTable = resultSet.Tables("Patient")
            GridView1.DataSource = dt.TableName("Patient")
            Page.DataBind()
asp
 <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1">
    </asp:GridView>
   <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
        SelectMethod="Connect" TypeName="WebApplication1.Login">
    </asp:ObjectDataSource>
</asp:Content>

Why do I keep getting The DataSet in data source 'ObjectDataSource1' does not contain any tables.
Thank you !
Kate
0
Comment
Question by:zagorovskaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 21

Expert Comment

by:masterpass
ID: 33633171
I have no idea why you have an objectdatasource here when you are binding data from codebehind

if you want to correct codebehind

 Dim dt As DataTable = resultSet.Tables("Patient")
 GridView1.DataSource = dt.TableName("Patient")
 GridView1.DataBind() //its gridview1.databind and not page

now if you want objectdatasource, I suggest you take a look here

http://www.codeproject.com/KB/aspnet/GridViewObjectDataSource.aspx
0
 
LVL 21

Expert Comment

by:masterpass
ID: 33633174
and forgot to mention why you are getting this error ... its because your select method of the objectdatasource is not returning any data at all ... I would suggest you check the return in your Select() method of ObjectDataSource. If it does not contain any table, create an empty one.
0
 

Author Comment

by:zagorovskaya
ID: 33638124
Thanks a lot Sage. I removed the ObjectDataSource from aspx and got this error

The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'ObjectDataSource1' could not be found.

I am new to .net. Trying to figure it out.  here is how it is now:
 
 Dim dt As DataTable = resultSet.Tables("Patient")
  GridView1.DataSource = dt.TableName("Patient")
  GridView1.DataBind()
 and
 
     </p>
    <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1">
    </asp:GridView>

and it says I am missing ObjectDataSource
0
 
LVL 21

Accepted Solution

by:
masterpass earned 50 total points
ID: 33642989
I think you forgot to remove the reference of the objectdatasource from the gridview markup

 <asp:GridView ID="GridView1" runat="server" >
    </asp:GridView>

remove the  DataSourceID="ObjectDataSource1" from gridview and you will be good to go
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question