Re: DataAdapter.Update???
From: Darryn Ross (darryn_at_datawave.com.au)
Date: 09/13/04
- Next message: Joyjit Mukherjee: "Re: Weird SqlDataReader: Invalid attempt to read when no data is present."
- Previous message: DotNet Ed: "Re: Weird SqlDataReader: Invalid attempt to read when no data is present."
- In reply to: Val Mazur: "Re: DataAdapter.Update???"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 13 Sep 2004 12:47:33 +1000
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[i] ;
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 ;
"Val Mazur" <group51a@hotmail.com> wrote in message
news:ej3Zm4SmEHA.2500@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> What is your code?
>
> --
> Val Mazur
> Microsoft MVP
>
>
> "Darryn Ross" <darryn@datawave.com.au> wrote in message
> news:%23$ZrpoSmEHA.3452@TK2MSFTNGP15.phx.gbl...
> > 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
> >
> >
>
>
- Next message: Joyjit Mukherjee: "Re: Weird SqlDataReader: Invalid attempt to read when no data is present."
- Previous message: DotNet Ed: "Re: Weird SqlDataReader: Invalid attempt to read when no data is present."
- In reply to: Val Mazur: "Re: DataAdapter.Update???"
- Messages sorted by: [ date ] [ thread ]