DataSet columns
-
I have a class that returns a dataset, csServices GetDataServices = new csServices(); gvServices.DataSource = GetDataServices.ServicesDS; gvServices.DataMember = "tbl_Services"; all im doing is reading data, dont need to update etc.. Although my dataset (ServicesDS) returns 1 table and 6 columns, i dont need to show all the columns in my gridview(gvServices), how can I only show the columns I specifiy ie "ID", "Name"? Following on.. should I be ref to a dataset or datatable, pros, cons? thanks
-
I have a class that returns a dataset, csServices GetDataServices = new csServices(); gvServices.DataSource = GetDataServices.ServicesDS; gvServices.DataMember = "tbl_Services"; all im doing is reading data, dont need to update etc.. Although my dataset (ServicesDS) returns 1 table and 6 columns, i dont need to show all the columns in my gridview(gvServices), how can I only show the columns I specifiy ie "ID", "Name"? Following on.. should I be ref to a dataset or datatable, pros, cons? thanks
You're not telling which GridView you're using, web control, WPF etc? Anyway, most gridviews work in a way that if you don't add columns to it before you bind the data, all columns are added automatically. So you should create the necessary columns beforehand either in code or in designer.
The need to optimize rises from a bad design.My articles[^]
-
You're not telling which GridView you're using, web control, WPF etc? Anyway, most gridviews work in a way that if you don't add columns to it before you bind the data, all columns are added automatically. So you should create the necessary columns beforehand either in code or in designer.
The need to optimize rises from a bad design.My articles[^]
-
If you're using DataGridView, then you could use for example DataGridViewColumnCollection.Add Method [^] to add desired column to the DataGridView before you bind the data (or add the columns in designer).
The need to optimize rises from a bad design.My articles[^]
-
I have a class that returns a dataset, csServices GetDataServices = new csServices(); gvServices.DataSource = GetDataServices.ServicesDS; gvServices.DataMember = "tbl_Services"; all im doing is reading data, dont need to update etc.. Although my dataset (ServicesDS) returns 1 table and 6 columns, i dont need to show all the columns in my gridview(gvServices), how can I only show the columns I specifiy ie "ID", "Name"? Following on.. should I be ref to a dataset or datatable, pros, cons? thanks
I use 2 methods limit the columns selected from the database, this gets rid of useless columns set the column. visible = false - this hides the columns that are required but do not need to be seen by the user (id column) You can still access the data in a non visible column
Never underestimate the power of human stupidity RAH