0
The whole concept of objective programming is that objects take care of themselves. As the control is an object it will take care of itself. When you bind a datasource (like the data table) to the datagrid, any changes that you make to the datasource are automatically reflected in the datagrid and vice-versa. Therefore you don't need to refresh the datagrid or update the changes to the datatable.
As for batch updating, the dataset is a container for data tables. The dataset will keep track of updates, deletions and additions to the datatables. When you are ready, you hook up to your data data adapter though the update method and all of the changes are made to the database. If you choose to do this on a record by record case or as a batch is totally up to you.
I've noticed that since you've joined, amittinku, you've blanketed this forum with very basic questions. Before posting on this topic again, I highly recommend that you do some basic research for yourself. There are a number of good web-sites, including this one, books, etc. that cover objective programming, ADO.NET and database handling. Nobody is going to spend as much time as you require to tutor you in a forum. Forums exist to get answers to questions that you can't find for yourself.

0
Whatever you have replied, I am agree with that and aware about that.
My requirement is that if I add/delete/update more than 1 record at a time in grid, How can I
1. Refresh the data grid
2. Update the changes in table
I want to know is there any batchupdate concept related to dataset/dataadapter?
0
It looks to me like you're going about this the hard way. Why do you want to pull the data from the datagrid like that? Assuming I read it right, you have one row that has an integer and the next row has a string value. Forgive me, but why? I personally would set up the datagrid with 2 columns.; one column representing the values of aa and the second representing the values of ss.
The way the datagrid works is that columns represent the fields in a datarecord and rows are the records. The easiest way to work the datagrid is using the designer, the hard way is to program it yourself. Forgive me if the following snippet is wrong, my skill with C# is seriously lacking, I prefer to work in VB .Net
private DataGrid dataGrid1;
private DataGridTableStyle dgts;
private DataGridTextBoxColumn dgcAA;
private DataGridTextBoxColumn dgcSS;
dataGrid1 = new DataGrid();
dgts = DataGridTableStyle();
dgcAA = new DataGridTextBoxColumn();
dgcSS = new DataGridTextBoxColumn();
dataGrid1.TableStyles.AddRange(new DataGridTableStyle[] {
dgts});
dgts.GridColumnStyles.AddRange(new DataGridColumnStyle[] {
this.dgcAA,
this.dgcSS});
Now bind the datatable(dt) to to your datagrid:
dataGrid1.DataSource = dt
Your data will now be stored in a datatable, which can be easily written to a database.
It sounds to me like you don't know much about data handling in the .NET framework. I would check out some of the stuff at this site to get some insight because going any further than this is beyond any time that I am willing to invest.

0
Hi MythicalMe:
In C# windows application:
There is a datagrid. There are 2 textboxes. There is one table "TEST" in oracle with 2 fields "A" and "B". I add more than 1 record i.e. I keep on adding records in datagrid at one go. How can I save all these records in table at one go?
Similary for update/delete operations.
I am currently using the following code to handle one record:
int aa=Int32.Parse(dataGrid1[dataGrid1.CurrentRowIndex,0].ToString());
string ss=dataGrid1[dataGrid1.CurrentRowIndex,1].ToString();
string ins="Insert into test values("+aa+","+"'"+ss+"')";
dt=cc.conn(ins);
dt.AcceptChanges();
You are right that datagrid is better for display and navigation purpose. But being a tabular representation, it gives a better display of data to user. Now requirement is that user can add/delete/update more than one records at one time. How to do this?
0
What exactly are you trying to do? Are you trying to combine 2 data records together and display them simultanteously? or Relationally? Either way will require the use of a dataset.
The datagrid has many useful functions, but it doesn't manipulate data. It is an interface between the user and the data. In my projects I haven't found the datagrid a really useful tool for anything except to use in presenting data in a tabular format and navigation. It has the ability for parent/child relational displays, but it is cumbersome AND you have to be very careful about screening your data. Something as simple as a DBNULL can break the control (your user could be left stuck on the child).
If you want to play with the relational aspects of the control, here's what you do. Define a dataset with 2 tables and a relationship between the 2 tables. Bind that dataset to the datagrid as a datasource (this can all be done from the designer). Now execute the program. You'll find the datagrid starts with a boxed square. Stop the program and specify the parent table as the data member. If your relation is correct, the parent table is displayed with child table name under each row. Click on the child name and the child is displayed.
