C
Chris
Hi,
I want to limit the amount of data shown in a page coming from a database.
Everything works except that I get the error:
"Unable to cast object of type 'System.Web.UI.WebControls.SqlDataSource' to
type 'System.Collections.IEnumerable'"
on line: PageDataSource.DataSource = SqlDataSource2
Thanks for help
code-behind:
-----------
Imports System.Data
Imports System.Data.OleDb
Partial Class Item
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim PageDSource As New PagedDataSource()
PageDSource.DataSource = SqlDataSource2
PageDSource.AllowPaging = True
PageDSource.PageSize = 6
End Sub
End Class
aspx file:
---------
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$
ConnectionStringsrod %>"
SelectCommand="SELECT * FROM [Prod] WHERE ([ItemId] = @ItemId)">
<SelectParameters>
<asp:QueryStringParameter Name="CId" DefaultValue="1"
QueryStringField="ite" />
</SelectParameters>
</asp:SqlDataSource>
I want to limit the amount of data shown in a page coming from a database.
Everything works except that I get the error:
"Unable to cast object of type 'System.Web.UI.WebControls.SqlDataSource' to
type 'System.Collections.IEnumerable'"
on line: PageDataSource.DataSource = SqlDataSource2
Thanks for help
code-behind:
-----------
Imports System.Data
Imports System.Data.OleDb
Partial Class Item
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim PageDSource As New PagedDataSource()
PageDSource.DataSource = SqlDataSource2
PageDSource.AllowPaging = True
PageDSource.PageSize = 6
End Sub
End Class
aspx file:
---------
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$
ConnectionStringsrod %>"
SelectCommand="SELECT * FROM [Prod] WHERE ([ItemId] = @ItemId)">
<SelectParameters>
<asp:QueryStringParameter Name="CId" DefaultValue="1"
QueryStringField="ite" />
</SelectParameters>
</asp:SqlDataSource>