Visual Studio .NET - How do I bind a large dataset to DataGridView
Asked By Rob Dob on 01-Feb-07 10:02 PM
Hi,
I have a dataset that contains over one million records, currently I am loading the dataset and then setting the DataSource property of my DataGridView to the datset, my DataGridView takes about 5 mins to load, 2.5 mins is spend waiting on the dataset to get populated and the other 2.5 mins on the DataGridView to load. I have been doing some research and it appears that I have to put the DataGridView into virtual mode, however what am I then suppose to do with my DataSet, are there any examples of something like this being done, as I am sure it must be a very common task. My DataGridView needs to also support the adding, deleting and editing of records.
Thanks in advance,
Sushila Patel replied to Rob Dob on 01-Feb-07 11:12 PM
you can use paging or
You can load only the necessary data by using DataAdpter.Fill below way
myAdapter.Fill( ds , startRecord , int.Parse( PageSize.Value ) , "Products");
To check more about this take a look BuildGrid method of link
http://www.mastercsharp.com/article.aspx?ArticleID=76&&TopicID=2
Complex Databinding
sundar k replied to Rob Dob on 01-Feb-07 11:13 PM
Just check out this article on "Binding Data To The User Interface", it tells you the various data binding modes and also how to handle complex data binding with a small case study,
Simple Data Binding
Complex Data Binding
One-way and two-way Data Binding
The BindingContext object
The Data Form Wizard
http://blogs.wdevs.com/a.Panahy/archive/2005/02/08/2254.aspx
just some links FYI,
DataSets vs. Collections
http://msdn.microsoft.com/msdnmag/issues/05/08/CuttingEdge/default.aspx
hope it helps!
use Custom Paging in ASP.NET 2.0 with SQL Server 2005 so it will bind only 10 or aome count rows only
K Pravin Kumar Reddy replied to Rob Dob on 01-Feb-07 11:45 PM
use Custom Paging in ASP.NET 2.0 with SQL Server 2005 , coz this will bind only 10 or some no of records to grid at a time not comelete data so this will help u in loding gridview
check out complete example here
http://aspnet.4guysfromrolla.com/articles/031506-1.aspx
Fetch less numer of records
Rajesh Madhukar replied to Rob Dob on 02-Feb-07 06:43 AM
It is not a good practice to bind a lasrge dataset to a grid control. Practically there is less probability that a user will to to every page of you grid. A better option will be to fetch records for pages where you think proablility of user interaction is high e.g. first 10 pages recordes containing recent data. If user wants to visit page number 15 then you can fetch data for page number 11 to 20.(User could be looking for some records). I mean to sa that in case of large data you have to guess user's action and to code accordingly(little complex coding).
Rajesh Madhukar

Hi ffriends, I want to bind a dataset to formview. . .how to do this. . . . You cannot bind a dataset to the formview, you need to bind one of it's datatables. FormView1.DataSource = myDataSet.Tables[0]; FormView1.DataBind(); Hi Shanmugam, Binding of dataset to formview is quite difficult You can bind formview to either datatable or datasource. Refer
Crystal Reports VB.NET 06-Jun-13 10:32 AM Hi All, How can i bind a datasource(dataset or datatable) for a crystal report in runtime. And also how can i add a the report at runtime. Can any one hep me on this? Regards Shabu.K To bind a CR to a datatable at runtime: Design your Report using the CR GUI. Create you have all of the data you need in your datatable, we'll have to bind the report. Create a new instance of the report, load it, and bind using a for loop: Dim rpt as new ReportDocument() rpt.Load("C: \ myreportname.rpt") Dim Binding, Tables, database, Refresh description: Runtime Binding in Crystal Reports Hi All, How can i bind a datasource(dataset or datatable) for a crystal report in runtime. And also how can i add
how to bind drop down from dataset Hi, use the below code for binding the dataset to dropdown. . . Dataset ds = new Dataset(); / / fill dataset uing data from database DropDownList1.DataTextField = "Text Column Name"; / / Set the column name which is
This is a simple article which describes how to bind a dataset to a comboBox. In this article we assume that user know how to fill a dataset object with desired Data. If you don't know how to fill a dataset, here is a simple step as follows: 1. Suppose you are using Access database named oleDbConnection(sConnectionString); / / create data adapter oleDbdataAdapter adp = new oleDbdataAdapter( "select * from Categories" , cn); / / Create a Dataset DataSet ds = new DataSet(); adp.Fill(ds); / / NOW you hav a data set which contains the
created."} System.Exception {System.ArgumentException} Thanks in advance for any help. / / Sort bound DataGridView / / Create DataSet based on default DataGridView. DataSet dataSet = (DataSet)dgvToSort.DataSource; / / Create Dataview and set it to DefaultView of the DataSet. DataView dataView = dataSet.Tables[0].DefaultView; / / Set Sort. dataView.Sort = "Orientation, Position asc" ; / / Set DataGridView to show sorted DataView. dgvToSort.DataSource = dataView; dgvToSort.DataMember = "FieldsConfig " ; The DataTable was bound to the DataGridView in this way: / / Create
Hi, I have a string array which contain some information. Now I want to fill dataset table with this array information. like string[] s = (string[])Session["Name1"]; for(int i = 0 where reg_key = '"+s[i]+"'"; SqlDataAdapter sd = new SqlDataAdapter(query, conn); sd.Fill(ds, "tab"); DataGrid1.DataSource = ds; DataGrid1.DataBind(); } But this shows a blank datagrid where is the problem? please help Substring(0, s1.LastIndexOf( ", " )) + ")" ; SqlDataAdapter sd = new SqlDataAdapter (query, conn); sd.Fill(ds, "tab" ); DG1.DataSource = ds; DG1.DataBind(); keywords: Visual Studio .NET, SqlDataAdapter, LastIndexOf, DataBind, Substring, string array, query string description: Dataset bind with array Hi, I have a string array which contain some information. Now I want to fill dataset table with this array information. like s
Dear Sir I am using dataset as a datasource to bind crystal report. how to bind this dataset dynamic to unbound column in crystal report using c# 2.0 please send me code crystlmn / html / crtsksettingupanado.netreportinaviewer.htm keywords: Crystal Report dynamic Dear Sir, report, Check, crystal report, dataset description: How to bind dataset with Crystal Report dynamic Dear Sir I am using dataset
DataSet _bid = new DataSet(); _bid = serviceus.Get_SERVICEUS_BIDS_ALL(); DataSet _project = new DataSet(); _project = serviceus.Get_SERVICEUS_PROJECT_ALL(); please help me i am beginer this is my code then how to bind the above two dataset values in datagrid.plese send code without join concept If both the table names are same you can use the dataset.merge method and bind the restult to a grid. Ex: MyCommand = new SqlDataAdapter("exec s_get_table1
I am taking three dataset and i want to bind all dataset value in a single gridview.so plz can help me???????? vivek sachan 9582134764 DataSet ds = dut.getDataSet( "select Class, CurrentLevel, Name from Tbl_StudentDetails where RollNo = '" + Request[ "RNo" ].ToString() + "'" ); foreach string s2 = DR[ "Class" ].ToString(); string s3 = DR[ "CurrentLevel" ].ToString(); string s4 = DR[ "Name" ].ToString(); } DataSet ds1 = dut.getDataSet( "select count(Status) from Tbl_Attendence where RollNo = '" + Request[ "RNo" ].ToString() + "'" ); foreach ( DataRow DR1 in ds1.Tables[0].Rows) { string s5 = DR1[ "Status" ].ToString(); } DataSet ds2 = dut.getDataSet( "select FMonth, Fyear, TPendingFee, Fees from Tbl_SFee where RollNo = '" + Request[ "RNo" ].ToString
dataset to dataview to dataset show an example for dataset to dataview and then dataview to dataset Rohini, Dataset to DataView SqlCommand mySqlSelect = new SqlCommand( "select * from categories" , mySQLconnection); mySqlSelect.CommandType = CommandType.Text; SqlDataAdapter mySqlAdapter = new SqlDataAdapter(mySqlSelect); DataSet myDataSet = new DataSet(); mySqlAdapter.Fill(myDataSet); / / Convert DataSet to DataView using DefaultView property associated with