Hi,
I am a new to C# and wanted to know about the row-id. I am developing a windows application and want to update perticular record depending on the row-id. So please any one can help me to write the code for updating the records in the table depending on the "Row-id".
Thanks,
Sheetal
Loading

Koteswararao MallisettiRank #2,740 · 511 reputationPosted Aug 3, 2010, 4:50 AM EDT
if it is datagrid , you neee not write any update query what ever the dataset is given to the datagird as a datasource it will automatically updated but it can't reflect on database for that we call thae update method of the dataadpter but this method is work when we pass this dataadpter ot command builder object
sqlDataAdapter da = new sqlDataAdapter("select Query",connection Object);
Dataset ds= new dataset();
da.fill(ds);
datagrid.datasource=ds;
sqlCommandBuilder cmb =new sqlCommandBuilder(da);
in update button
da.update(ds) ;
Note:all variables as declare as global
sheetal patil3 reputationPosted Aug 3, 2010, 7:25 PM EDT
thanks.
Rahul Kumar SaxenaRank #36 · 36.5K reputationPosted Aug 3, 2010, 9:33 PM EDT
int i;
int myRowId;
on DataGridView1_CellClick Event in DataGrid
i = DataGridView1.CurrentRow.Index
myRowId = DataGridView1.Item["ColumnName", i].Value