RSS Forums RSS
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting

IListSource does not contain any data sources

Join Date: Jun 2005
Location: Iowa *sob*
Posts: 36
Reputation: npasma is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
npasma's Avatar
npasma npasma is offline Offline
Light Poster

Re: IListSource does not contain any data sources

  #9  
Jul 27th, 2005
After finishing my research on Session() I have the proper lines of code for what I intend, yet the error persists. My fellow programmers seem perplexed as well. Here are the changes I made:


In the page load method:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then
            dsSoftware = SoftwareDB.getEntries
            Me.BindDataGrid()
            Session("dsSoftware") = dsSoftware
        Else
            'no code needed here, the previous code returned too much of the dataset
        End If
    End Sub

This code is from the end of the button Search click method:
Connect.ConnectionString = ConnectString
        Adapter.SelectCommand = New OleDbCommand(SelectStatement, Connect)
        Adapter.SelectCommand.Connection.Open()
        Adapter.Fill(dsSoftware, "[SOFTWARE DATABASE]")
        softwareGrid.DataSource = dsSoftware.Tables("[SOFTWARE DATABASE]")
                Session("dsSoftware") = dsSoftware
        Page.DataBind()
    End Sub
Here I update the Session to cause the dataset to contain my search results only.

After stepping through all of the program's execution, I have found that the error occurs as a result of this code:

Public Sub softwareGrid_EditCommand(ByVal source As Object, _
        ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _
        Handles softwareGrid.EditCommand

        If Session("Add Mode") = True Then
            Dim i As Integer = dsSoftware.Tables("[SOFTWARE DATABASE]").Rows.Count - 1
            dsSoftware.Tables("[SOFTWARE DATABASE]").Rows(i).Delete()
            Session("AddMode") = False
        End If
        softwareGrid.EditItemIndex = e.Item.ItemIndex
        'this is the line that triggers the error:
        Me.BindDataGrid()
    End Sub

I've called BindDataGrid before, and it works great. This time, however, it claims there is not dataset source, even though I just gave it one TWO LINES before!!!

Just for review:
Private Sub BindDataGrid()
        softwareGrid.DataSource = dsSoftware
        softwareGrid.DataMember = "[SOFTWARE DATABASE]"
        softwareGrid.DataKeyField = "Software #"
        softwareGrid.DataBind()
    End Sub

So thats where Im at. We are stuck for now. I will revisit this problem tomorrow with some of my coworkers. See what you think! At least I feel better educated now!
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 12:04 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC