الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

i want quick help(aspnet)

مغلق
بدأه Aljamalimohammed في 18 يوليو 2002 · 2 رد · 494 مشاهدة · في منتدى تصميم صفحات الويب
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

when i run my page i get paging Error for Data access and i try to fix it but no way Error is

----------------------------------------------------------------------------------

Error:

AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID dgTransactions when AllowPaging is set to true and the selected datasource does not implement ICollection.

-------------------------------------------------------------------------------------

the code is

<%@ Page Language="VB" Debug="true" %>

<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="System.Data.OleDb" %>

<script language="VB" Debug="true" runat="server">

dim conn as new oleDBConnection("provider=" & _

"Microsoft.Jet.OLEDB.4.0;" & _

"Data source=f:bankingbanking.mdb")

Sub Page_Load(Source As Object, E As EventArgs)

If Not IsPostBack Then

bindDataGrid

End If

End Sub

Sub bindDataGrid

dim objCmd as OleDbCommand=new OledbCommand("spGetTransactions",conn)

ObjCmd.commandType=CommandType.StoredProcedure

dim objReader as oledbDataReader

dim objParam as oledbParameter

objParam=ObjCmd.parameters.add("@UserID",OleDbType.BSTR)

ObjParam.Direction=ParameterDirection.Input

'objparam.value=request.Cookies("Account").value

objparam.value=session("Uid")

try

objCmd.connection.open

objReader=objCmd.ExecuteReader

dgTransactions.DataSource=ObjReader

dgTransactions.Databind()

objReader.close

objCmd.connection.close

catch ex as OleDbException

lblMessage.text =ex.Message

end try

End Sub

Sub doPaging(s As Object, e As DataGridPageChangedEventArgs)

dgTransactions.CurrentPageIndex = e.NewPageIndex

bindDataGrid

End Sub

AutoGenerateColumns="true"

AllowPaging="true"

PageSize="5"

PagerStyle-Mode="NumericPages"

PagerStyle-HorizontalAlign="Center"

OnPageIndexChanged="doPaging"

BackColor="White"

BorderWidth="1px" BorderStyle="Solid"

Width="100%"

BorderColor="Salmon"

CellPadding="2" CellSpacing="0"

Font-Name="Verdana" Font-Size="8pt">

Font-Bold="True" BackColor="Yellow"

HorizontalAlign="center">

#2

Hello,

Use Dataset as the datasource of your DataGrid as it implements Icollection.Using AllowCustomPaging requires VirtualItemCount which I think is dificult to generate with DataReader.

Hope this Helps

Tahiyati

Madani

#3

Thankx Yes what u siad is right!

i used

MyConnection = New OledbConnection ("provider=" & _

"Microsoft.Jet.OLEDB.4.0;" & _

"Data source=f:bankingbanking.mdb")

MyCommand = New OledbDataAdapter(SelectCommand, MyConnection)

MyCommand.SelectCommand.Parameters.Add(New OledbParameter("@UserID",OleDbType.BSTR))

MyCommand.SelectCommand.Parameters("@UserID").value = session("Uid")

DS = new DataSet()

MyCommand.Fill(DS, "tblTransactions")

MyDataGrid.DataSource=DS.Tables("tblTransactions").DefaultView

MyDataGrid.DataBind()

هذا الموضوع مغلق.

مواضيع مشابهة