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.Sql DataSource' to
type 'System.Collect ions.IEnumerabl e'"
on line: PageDataSource. DataSource = SqlDataSource2
Thanks for help
code-behind:
-----------
Imports System.Data
Imports System.Data.Ole Db
Partial Class Item
Inherits System.Web.UI.P age
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Dim PageDSource As New PagedDataSource ()
PageDSource.Dat aSource = SqlDataSource2
PageDSource.All owPaging = True
PageDSource.Pag eSize = 6
End Sub
End Class
aspx file:
---------
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server" ConnectionStrin g="<%$
ConnectionStrin gs:prod %>"
SelectCommand=" SELECT * FROM [Prod] WHERE ([ItemId] = @ItemId)">
<SelectParamete rs>
<asp:QueryStrin gParameter Name="CId" DefaultValue="1 "
QueryStringFiel d="ite" />
</SelectParameter s>
</asp:SqlDataSour ce>
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.Sql DataSource' to
type 'System.Collect ions.IEnumerabl e'"
on line: PageDataSource. DataSource = SqlDataSource2
Thanks for help
code-behind:
-----------
Imports System.Data
Imports System.Data.Ole Db
Partial Class Item
Inherits System.Web.UI.P age
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Dim PageDSource As New PagedDataSource ()
PageDSource.Dat aSource = SqlDataSource2
PageDSource.All owPaging = True
PageDSource.Pag eSize = 6
End Sub
End Class
aspx file:
---------
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server" ConnectionStrin g="<%$
ConnectionStrin gs:prod %>"
SelectCommand=" SELECT * FROM [Prod] WHERE ([ItemId] = @ItemId)">
<SelectParamete rs>
<asp:QueryStrin gParameter Name="CId" DefaultValue="1 "
QueryStringFiel d="ite" />
</SelectParameter s>
</asp:SqlDataSour ce>
Comment