I am using the dataset in a disconnected mode.
I realize that the database will not get updated until I
call the update method, but the disconnected dataset
should properly reflect the changes after I call the delete
() method.
Here is a simple example that demonstrates my point:
Dim oDS As New DataSet()
Dim oTbl As New DataTable()
Dim oRow As DataRow
oTbl.Columns.Add("column1")
oTbl.Columns.Add("column2")
oRow = oTbl.NewRow
oRow(0) = "A"
oRow(1) = "B"
oTbl.Rows.Add(oRow)
'shows 1
MessageBox.Show(oTbl.Rows.Count)
oTbl.Rows(0).Delete()
'shows 0
MessageBox.Show(oTbl.Rows.Count)
After the delete the rowcount goes to 0. In my original
post the rowcount does not decrement after the delete.
Why ????
>-----Original Message-----
>it wont delete until you update using the datadapters
update method
>
>--
>Regards - One Handed Man
>
>Author : Fish .NET & Keep .NET
>
>==============================
>"John Zink" <(E-Mail Removed)> wrote in message
>news:0d1701c36c99$e2b6c210$(E-Mail Removed)...
>> If I call the delete method on a datatable that is
>> returned from a web service the delete appears to work,
>> but the row is still in the rows collection. I do not
>> receive any errors, but if after the delete I loop thru
>> the rows collection with a for each loop I get an error
>> when I hit the row. After I call AcceptChanges the row
is
>> gone and I can get around the for each problem by
checking
>> the rowstate, but I thought that after calling delete it
>> wouldn't be accessible. Also after the delete the
>> rowCount is not decremented.
>> Here is the code snippet:
>>
>> Dim oServices As New UWEngineServices.UWEngineServices()
>> oDS = oServices.GetRulesetInfo("d067268", txtRSId.Text)
>>
>> 'shows 1
>> MessageBox.Show(oDS.UW_RULESETS.Count)
>> 'shows false
>> MessageBox.Show(oDS.HasErrors)
>> oDS.UW_RULESETS(0).Delete()
>> 'shows 1
>> MessageBox.Show(oDS.UW_RULESETS.Count)
>> 'shows false
>> MessageBox.Show(oDS.HasErrors)
>
>
>.
>
|