C
Chris Voon
I have some records in SQL CE 2.0 and would like to delete
all the rows. I obtain the data using SQLCE data adapter
and DataSet and managed to populate the data. Following i
tried to issue a delete + acceptchanges on to the rows and
do an update. The records are not deleted! I also try with
the removeat method which seems to have worked fine in
removing the rows. But ultimately when an update method is
invoked, nothing has changed. Here's the code I use.
Try
Dim strSQL = "SELECT * FROM JOB_HEADER WHERE
job_id='PPC00020031212121212'"
Dim myda As New SqlCeDataAdapter
myda.SelectCommand = New SqlCeCommand("SELECT
* FROM JOB_DELAY WHERE job_id='PPC00020031212121212'",
m_jobConn)
Dim cb2 As SqlCeCommandBuilder = New
SqlCeCommandBuilder(myda)
Dim ds As DataSet = New DataSet
myda.Fill(ds, "JOB_DELAY")
' Trying to Issue a delete command for old
records
Dim rowIndex As Integer
While ds.Tables("JOB_DELAY").Rows.Count > 0
ds.Tables("JOB_DELAY").Rows.RemoveAt(0)
End While
myda.Update(ds, "JOB_DELAY")
Catch ex As SqlCeException
ToolSet.ErrorHelper.ShowSqlCeErrors(ex)
End Try
all the rows. I obtain the data using SQLCE data adapter
and DataSet and managed to populate the data. Following i
tried to issue a delete + acceptchanges on to the rows and
do an update. The records are not deleted! I also try with
the removeat method which seems to have worked fine in
removing the rows. But ultimately when an update method is
invoked, nothing has changed. Here's the code I use.
Try
Dim strSQL = "SELECT * FROM JOB_HEADER WHERE
job_id='PPC00020031212121212'"
Dim myda As New SqlCeDataAdapter
myda.SelectCommand = New SqlCeCommand("SELECT
* FROM JOB_DELAY WHERE job_id='PPC00020031212121212'",
m_jobConn)
Dim cb2 As SqlCeCommandBuilder = New
SqlCeCommandBuilder(myda)
Dim ds As DataSet = New DataSet
myda.Fill(ds, "JOB_DELAY")
' Trying to Issue a delete command for old
records
Dim rowIndex As Integer
While ds.Tables("JOB_DELAY").Rows.Count > 0
ds.Tables("JOB_DELAY").Rows.RemoveAt(0)
End While
myda.Update(ds, "JOB_DELAY")
Catch ex As SqlCeException
ToolSet.ErrorHelper.ShowSqlCeErrors(ex)
End Try