Paging with Datagrid Control

Discussion in 'ASP .Net Datagrid Control' started by Elton W, Apr 22, 2005.

  1. Elton W

    Elton W Guest

    Hi Joey,

    First of all, when performing paging we need rebind
    datagrid's data source. But the data source could be a
    dataset, or datatable, or some other data collection.

    Secondly, dataset can be filled by either SqlDataAdapter
    or OleDbDataAdapter from database (, or even by reading
    XML file). You don't have to use SqlDataAdapter.

    Hence in your case, you can use OleDbDataAdapter to pull
    data from access database:

    OleDbDataAdapter dap = new OleDbDataAdapter(Select_Query,
    Connection_String) ;
    DataTable table = new DataTable();
    Dap.Fill(table);
    DataGrid.DataSource = table;

    BTW, please take look following URL:
    http://msdn.microsoft.com/library/default.asp?
    url=/library/en-us/cpguide/html/cpconoverviewofadonet.asp

    HTH

    Elton Wang



    >-----Original Message-----
    >Hi all,
    > I have met some problems in implementing paging

    with datagrid
    >control. From what i know to do paging we must use

    sqlDataAdapter and
    >dataset but I am using microsoft access database instead

    of SQL server as a
    >result i cant use SqlDataAdapter and dataset to retrieve

    data from
    >microsoft access. Anyone knows whether there is a way to

    do paging
    >connected with access?Can i have the source code to see

    how it works if
    >there is a way to solve my problem. Thanx....
    >.
    >
    Elton W, Apr 22, 2005
    #1
    1. Advertising

  2. Elton W

    Elton W Guest

    Hi Joey,

    1) Connection String:
    For Access, it's like:
    "Provider=Microsoft.Jet.OLEDB.4.0; Data
    Source=c:\bin\LocalAccess40.mdb"

    2) You are using Request("DeptID"). Suppose you want to
    get it from query string, it's better to use
    Request.QueryString.Get("DeptID"). Or if it's from HTML
    form textbox, use
    Request.Form.Get("DeptID")

    HTH

    Elton


    >-----Original Message-----
    >HI Elton Wang,
    > Really thanx for your scouce code. Really

    great... I had
    >being stuck for this problem for days....(",)
    >
    >But ihave some error after execute.This is the error.
    >
    >Format of the initialization string does not conform to

    specification
    >starting at index 0.
    >
    >objAdp = New OleDb.OleDbDataAdapter("select p.ProductID,

    p.ProductModel, "
    >& _
    > "p.ProductImage, p.Price, p.ProductDesc "

    & _
    > "from CategoriesProduct cp, Product p

    where " & _
    > "cp.ProductID = p.ProductID " & _
    > "and cp.CategoryID=" & Request

    ("DeptID"), "ConnectionDB")
    >
    >Is there any problem in this code?i cant figure out. Do

    you have any idea
    >on how to solve? Thanx and sorry to trouble you again...
    >.
    >
    Elton W, Apr 22, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    DataSet paging vs Datareader paging

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    10,685
    Scott Allen
    Oct 8, 2004
  2. Roger
    Replies:
    0
    Views:
    962
    Roger
    Dec 28, 2004
  3. wh1974
    Replies:
    0
    Views:
    2,430
    wh1974
    Jan 12, 2005
  4. Red
    Replies:
    1
    Views:
    716
  5. Green Start Button

    DataGrid.Items.Count and DataGrid Paging...

    Green Start Button, Aug 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,802
    agravar
    Aug 2, 2006
Loading...

Share This Page