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,004 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

626 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