Check this

Chirag Bhavsar replied to touseef ahmed at 12-May-08 12:57

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


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  datagrid or dataview send the data to dataset or datatable.. - touseef ahmed  12-May-08 03:55 3:55:39 AM
      Use the DataTable as the DataSource. - Peter Bromberg  11-May-08 05:05 5:05:30 PM
      Bind Datagrid - sundar k  11-May-08 10:50 10:50:59 PM
      DataGrid sending data - Sanjay Verma  11-May-08 11:53 11:53:50 PM
      Check here - santhosh kapa  12-May-08 12:05 12:05:35 AM
      Try This - Sujit Patil  12-May-08 12:26 12:26:53 AM
      Check this - Chirag Bhavsar  12-May-08 12:57 12:57:58 AM
      Have a look at this - chakradhar koturu  12-May-08 01:09 1:09:29 AM
View Posts