|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Paging with Datagrid ControlHi 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.... 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----- of SQL server as a>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 >result i cant use SqlDataAdapter and dataset to retrieve how it works ifdata from >microsoft access. Anyone knows whether there is a way to do paging >connected with access?Can i have the source code to see Show quoteHide quote >there is a way to solve my problem. Thanx.... >. > 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... 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----- great... I had>HI Elton Wang, > Really thanx for your scouce code. Really >being stuck for this problem for days....(",) where " & _> >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 > "cp.ProductID = p.ProductID " & _ you have any idea> "and cp.CategoryID=" & Request ("DeptID"), "ConnectionDB") > >Is there any problem in this code?i cant figure out. Do Show quoteHide quote >on how to solve? Thanx and sorry to trouble you again... >. > 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
Howto insert delete rows into a ASP.net datagrid?
read row values from datagrid and populate in new datagrid values from connected Accessing data object on delete command. Datagrid paging keeps going back to the first group MessageBox not showing before Response.Redirect ItemDataBound filtering from multiple dropdownlists Slow datagrid on postback how to use hyper columns in datagrid Error Message: FindControl requires that controls have unique IDs. |
|||||||||||||||||||||||