DataAdapter.Update???

  • Thread starter Thread starter Darryn Ross
  • Start date Start date
D

Darryn Ross

Hi,

I am getting the following error when calling the Adapters update method
after i have done some deletions from my dataset through a datagrid.

"Delete row information cannot be accessed through the row."

Can anyone please tell me what i am doing wrong?

Regards

Darryn
 
Here is my Delete Method, GetSelectedRows is a method i have in my custom
class that returns the indexes of all rows that are selected in an Array
List Type.

try {

ArrayList AlDeleteList = new ArrayList() ;

AlDeleteList = dg.GetSelectedRows(dg) ;

DataTable dt = Ds.Tables["tbl"] ;

int j = 0 ;

for(int i = 0; i < AlDeleteList.Count; ++i) {

j = (int)AlDeleteList ;

dt.Rows[j].Delete() ;

}

}

catch(Exception e) {

MessageBox.Show(e.Message, "DeleteTransaction", MessageBoxButtons.OK,
MessageBoxIcon.Error) ;

}


This is my Update Method....

bool result = true ;


try {

tblConnection.Open() ;

tblAdapter.Update(Ds, "tbl") ;

}

catch(Exception e) {

MessageBox.Show(e.Message, "Save", MessageBoxButtons.OK,
MessageBoxIcon.Error) ;

result = false ;

}

finally {

tblConnection.Close() ;

}

return result ;
 
Back
Top