how do i use datagrid to retrieve the diffrent information from few table by using the sql query
and
how to i use arrayList data to show up in the datagrid any one can provide me a simple example
how do i use datagrid to retrieve the diffrent information from few table by using the sql query
and
how to i use arrayList data to show up in the datagrid any one can provide me a simple example
datagird
Madian
You don't. DataGrid is unaware of SQL tables and queries and would show whatever's in the DataSource. So, the procedure has two steps:
1. Get data from SQL using respective query and store it in memory (in DataSet/DataTable, ArrayList, etc.).
2. Set grid's DataSource to the storage filled in step 1.
Here's the code to show data from ArrayList:
VB:
dataGrid.DataSource = myArrayList
C#:
dataGrid.DataSource = myArrayList;
Note ArrayList has no support for change notification and grid won’t be automatically updated should you change the list. Thus you would have to rebind for every data change which makes ArrayList poor choice as data source. BidningSource class is a better option.