|
-
July 15th, 2008, 02:18 PM
#1
Problems with delete
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
Code:
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
Code:
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
Last edited by Xitero; July 15th, 2008 at 02:35 PM.
-
July 17th, 2008, 12:09 PM
#2
Re: Problems with delete
Well, I managed to solve that. The tableAdapter did not have a definition for delete, I was thinking that was automatic
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|