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
Rahul Kumar SaxenaPosted Aug 4, 2010, 1:33 AM
int i;
int myRowId;
on DataGridView1_CellClick Event in DataGrid
i = DataGridView1.CurrentRow.Index
myRowId = DataGridView1.Item["ColumnName", i].Value
sheetal patilPosted Aug 3, 2010, 11:25 PM
thanks.
Koteswararao MallisettiPosted Aug 3, 2010, 8:50 AM
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