Click to See Complete Forum and Search --> : Problems with delete


Xitero
July 15th, 2008, 02:18 PM
Hi guys, I need some help in the following:

I'm using visual studio 2008 c# , sql server 2005 and .net framework 3.5

Whenever I delete a row with my program, the row is not deleted in my database. It's is like the changes have not been commited, but the insertions are commited...

I've tried to delete using many different ways, after many research, I found out what seems to be the correct way, but it is still no working. I get a strange message : "Update requires a valid DeleteCommand when passed DataRow collection with deleted rows."

first I call this

public int removeUser()
{
if (currentRow == null)
return 0;

//ds.tabela.RemovetabelaRow(currentRow);
currentRow.Delete();

return 1;
}


at the end of the program I try to update the dataset


private void FormAuth_FormClosed(object sender, FormClosedEventArgs e)
{
int result = tabelaTableAdapter.Update(ds);
MessageBox.Show(result.ToString() + " rows affected");
}


Isn't that supposed to work?

thanks in advance

Xitero
July 17th, 2008, 12:09 PM
Well, I managed to solve that. The tableAdapter did not have a definition for delete, I was thinking that was automatic