another delete prob.

M

Marc Miller

I've read other posts concerning unsuccessful deletes, but I can't find
anything that tells me what is wrong
with my code. After I delete() the row in the dataset, the dataset is empty
and I get 0 as the value for
my 'isDel' variable. What am I doing that I shouldn't be doing, or
vice-a-versa?

Thanks for any help,
Marc Miller

Dim sr As New StringReader(CStr(viewstate("dsbldgdata1")))

DsBldgData1.ReadXml(sr)

..DsBldgData1.Tables("Profile").Rows(0).Delete()

SqlConnection1.Open()


Dim iDel As Integer

Try

iDel = SqlDataAdapter1.Update(Me.DsBldgData1, "Profile")

Catch ex As Exception

errWindowShow(ex.message)

Finally

SqlConnection1.Close()

End Try
 
C

Cor Ligthert

Marc,

How did you create the rows in the dataset.

I ask this because when you did not do that from the original database table
(where you than did not use the option to avoid setting to unchanged), than
you have to do before the deletes an accept.changes.

The delete works as follows.
When the row state is "inserted" it will remove the row from the dataset.
In other situations it sets the rowstate to "deleted".

With the acceptchanges you change the new state to "unchanged".

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top