|
Hie, i'm still kind of new using ASP.NET. i'm doing this project using vb.net coding and Microsoft Access as database. my function is suppose to delete the record from the database, by referring to the information that is shown in a label control. here is my coding:
dsSchedule.Schedule.Clear()
daSchedule.Fill(dsSchedule)
Dim dr As DataRow
Dim tobefound As String
tobefound = lbleight.Text
For Each dr In dsSchedule.Tables("Schedule").Rows
If dr.Item("Title") = tobefound Then
dr.Delete()
Exit For
End If
Next
daSchedule.Update(dsSchedule)
dsSchedule.AcceptChanges()
it's suppose to delete the whole row that contains that title. but it doesn't work. when i click the button, it refreshes the page and the label is cleared. but it will appear again if i click another button. it doesn't have any error message either. anything wrong with my code? thanks.
|
|
|
try to use OleDbDataAdapter and OleDbCommandBuilder for updating.
ex:
Public Sub updateDataSet(ByRef aDataSet As DataSet, ByVal dsName As String)
Try
adapter.DeleteCommand = builder.GetDeleteCommand()
adapter.InsertCommand = builder.GetInsertCommand()
adapter.UpdateCommand = builder.GetUpdateCommand()
adapter.Update(aDataSet, dsName)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
|
|
|
|
|
|
|
|