I have been trying to delete a record with the following code, but not
receiving any results, not even an error message. I have verified that I am
passing a valid record index and that my connection is correct. I'm new to
ADO.Net and this is driving me crazy. Thanks in advance.
Private Sub RecDel(ByVal intRecIndex As Integer)
Try
Me.Cursor = Cursors.WaitCur sor
Dim myConnection As New SqlConnection(s trSqlConnection )
myConnection.Op en()
strSqlCommand = "SELECT * FROM USAD_10Digit WHERE RecIdx = " &
intRecIndex
Dim myCommand As New SqlCommand(strS qlCommand, myConnection)
myCommand.Execu teNonQuery()
myConnection.Cl ose()
Catch
If Err.Number <> 0 Then
MsgBox("Error:" & Str(Err.Number) & ControlChars.Cr Lf & _
Err.Description & ControlChars.Cr Lf & _
"Generated by " & Err.Source, _
MsgBoxStyle.Cri tical, Application.Pro ductName)
End If
Finally
Me.Cursor = Cursors.Default
End Try
End Sub
receiving any results, not even an error message. I have verified that I am
passing a valid record index and that my connection is correct. I'm new to
ADO.Net and this is driving me crazy. Thanks in advance.
Private Sub RecDel(ByVal intRecIndex As Integer)
Try
Me.Cursor = Cursors.WaitCur sor
Dim myConnection As New SqlConnection(s trSqlConnection )
myConnection.Op en()
strSqlCommand = "SELECT * FROM USAD_10Digit WHERE RecIdx = " &
intRecIndex
Dim myCommand As New SqlCommand(strS qlCommand, myConnection)
myCommand.Execu teNonQuery()
myConnection.Cl ose()
Catch
If Err.Number <> 0 Then
MsgBox("Error:" & Str(Err.Number) & ControlChars.Cr Lf & _
Err.Description & ControlChars.Cr Lf & _
"Generated by " & Err.Source, _
MsgBoxStyle.Cri tical, Application.Pro ductName)
End If
Finally
Me.Cursor = Cursors.Default
End Try
End Sub
Comment