Hi! ahmed
to fill datagrid using ds you need to follow these steps:
1. connection string. pass this database connection string to the connection object.
2. create sqlCommand object pass sqlQuery string and SQlconnection object as the argument.
3. create an object of sqldataAdapter pass sqlCommand object to this as argument.
4. create dataSet object.
5. call sqldataAdapter method fill eg; da.fill(ds)
6. assign dataset to the datasource property of datagrid.
7. call bind method of datagrid required for .net 1.1.
For the second part; to get the data in ds from datagrid.
1. craete dataTable object.
2. for each row in datagrid create the instances of datarow run the loop. and add these to the table.
3. finally at the end of the loop add this table to dataset.
you can do this by ds.Tables.Add([table object])
think this should clear you concepts |