简体   繁体   中英

Binding a listbox/datagrid view manually with Data Table Vs binding it with Data Sets.Data Table[0] in c# winForms

There are two ways in c# that I can bind my listbox with a datasource: 1) Query the SQL Server 2008 db and the query will return a Data Table which can use it to bind it to list box. 2) Create a new Data Set by right-clicking in the solution explorer and going through the wizard to complete it and finally calling the dataset.fill method to fill the data table which I can bind it to my list box.

I have a list box which displays the names of forms that I have created in C#. Basically this is used to grant which user has right on which form.

My question is which method should I go for? Currently I'm using method 1. Same question also goes for a data grid view.

It dosn't make any difference.

DataSet.Tables[integer] is a DataTable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM