F
fiaolle
Hi
I'm new to ADO in Visual Basic.Net and have problems with updating the
DataSet after I have done ExecuteNonQuery.
I'm using the code below
Private Sub cmdDel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdDel.Click
Me.OleDbConn.Open()
Me.OleDbDAFilmKat.DeleteCommand.Parameters(0).Value = Me.txtNr.Text
Me.OleDbDAFilmKat.DeleteCommand.ExecuteNonQuery()
Me.OleDbDAFilmKat.Update(DSFilm, "Film")
MaxRows = DSFilm.Tables("Film").Rows.Count
Me.OleDbConn.Close()
End sub
After this, when I'm using the DataSet DSFilm the DataSet isn't updated. But
when I restart the program the record is gone.
I have seen example where I should use Me.OleDbDAFilmKat.Fill(DSFilm,
"Film") instead, but it didn't help. I have also seen articles there I
should use this code
Dim oRow as DataRow
oRow = Me.DSFilm.Tables("Film").Rows(0)
oRow.Delete()
Then after that, use the DeleteCommand for the DataAdapter.
Do I have to do this above to delete a row in the Dataset, then use the
DataAdapter's DeleteCommand to delete a row in the Database. Isn't there
another way.
I have the same problem with InsertCommand and UpdateCommand.
Please Help !!!
Fia
I'm new to ADO in Visual Basic.Net and have problems with updating the
DataSet after I have done ExecuteNonQuery.
I'm using the code below
Private Sub cmdDel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdDel.Click
Me.OleDbConn.Open()
Me.OleDbDAFilmKat.DeleteCommand.Parameters(0).Value = Me.txtNr.Text
Me.OleDbDAFilmKat.DeleteCommand.ExecuteNonQuery()
Me.OleDbDAFilmKat.Update(DSFilm, "Film")
MaxRows = DSFilm.Tables("Film").Rows.Count
Me.OleDbConn.Close()
End sub
After this, when I'm using the DataSet DSFilm the DataSet isn't updated. But
when I restart the program the record is gone.
I have seen example where I should use Me.OleDbDAFilmKat.Fill(DSFilm,
"Film") instead, but it didn't help. I have also seen articles there I
should use this code
Dim oRow as DataRow
oRow = Me.DSFilm.Tables("Film").Rows(0)
oRow.Delete()
Then after that, use the DeleteCommand for the DataAdapter.
Do I have to do this above to delete a row in the Dataset, then use the
DataAdapter's DeleteCommand to delete a row in the Database. Isn't there
another way.
I have the same problem with InsertCommand and UpdateCommand.
Please Help !!!
Fia