I have this code:
Dim dv As New DataView(_DataSet.Tables(0))
' select deleted rows
dv.RowStateFilter = DataViewRowState.Deleted
For _irow As Long = 0 To dv.Table.Rows.Count - 1
If Not IsDBNull(dv!serial) Then
txtSerial.Text = (dv!serial).ToString
Dim strconnection As String = "Data Source=EASMAR-PC;Initial Catalog=Database Connection;Integrated Security=True;"
Dim _cn As SqlConnection = New SqlConnection(strconnection)
_cn.Open()
Dim cmd As New SqlCommand
cmd.CommandText = "Delete from tblCustomer where serial= " & (dv!serial).ToString
End If
Next
I am just looping trough the dataview(If the rowwstate is deleted, the delete from database).
I am getting this error: Conversion from string "serial" to type 'Integer' is not valid.
on this line : If Not IsDBNull(dv!serial) Then
Any ideas?