Home All Groups Group Topic Archive Search About
Author
22 Apr 2005 11:05 AM
Joey Liang via DotNetMonster.com
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....

Author
22 Apr 2005 12:30 PM
Elton W
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
elton_w***@hotmail.com


>-----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
Show quoteHide quote
>there is a way to solve my problem. Thanx....
>.
>
Author
22 Apr 2005 3:18 PM
Joey Liang via DotNetMonster.com
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...
Author
22 Apr 2005 8:40 PM
Elton W
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
Show quoteHide quote
>on how to solve? Thanx and sorry to trouble you again...
>.
>
Author
23 Apr 2005 3:00 AM
Joey Liang via DotNetMonster.com
Hi Elton,
         So happy it finally works!Thank you very much for your guides else
i am still stuck right now..You are really great in ASP.NET...Thumbs up for
you!Hee... :>

Thanx,
Joey

--
Message posted via http://www.dotnetmonster.com